Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/i2c iic(4): Use config_detach_children to simplify.



details:   https://anonhg.NetBSD.org/src/rev/34d9ba844464
branches:  trunk
changeset: 371994:34d9ba844464
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Oct 24 10:17:40 2022 +0000

description:
iic(4): Use config_detach_children to simplify.

diffstat:

 sys/dev/i2c/i2c.c |  17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diffs (39 lines):

diff -r af7b6032c545 -r 34d9ba844464 sys/dev/i2c/i2c.c
--- a/sys/dev/i2c/i2c.c Mon Oct 24 10:17:27 2022 +0000
+++ b/sys/dev/i2c/i2c.c Mon Oct 24 10:17:40 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i2c.c,v 1.89 2022/10/24 10:17:27 riastradh Exp $       */
+/*     $NetBSD: i2c.c,v 1.90 2022/10/24 10:17:40 riastradh Exp $       */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -53,7 +53,7 @@
 #endif /* _KERNEL_OPT */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.89 2022/10/24 10:17:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.90 2022/10/24 10:17:40 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -543,16 +543,11 @@
 static int
 iic_detach(device_t self, int flags)
 {
-       struct iic_softc *sc = device_private(self);
-       int i, error;
+       int error;
 
-       for (i = 0; i <= I2C_MAX_ADDR; i++) {
-               if (sc->sc_devices[i]) {
-                       error = config_detach(sc->sc_devices[i], flags);
-                       if (error)
-                               return error;
-               }
-       }
+       error = config_detach_children(self, flags);
+       if (error)
+               return error;
 
        pmf_device_deregister(self);
 



Home | Main Index | Thread Index | Old Index