Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/gpio gpioiic(4): Use config_detach_children.



details:   https://anonhg.NetBSD.org/src/rev/9deed573b8dd
branches:  trunk
changeset: 374689:9deed573b8dd
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed May 10 00:08:30 2023 +0000

description:
gpioiic(4): Use config_detach_children.

diffstat:

 sys/dev/gpio/gpioiic.c |  23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diffs (45 lines):

diff -r 1ffd5fb2569e -r 9deed573b8dd sys/dev/gpio/gpioiic.c
--- a/sys/dev/gpio/gpioiic.c    Wed May 10 00:08:22 2023 +0000
+++ b/sys/dev/gpio/gpioiic.c    Wed May 10 00:08:30 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpioiic.c,v 1.11 2021/08/07 16:19:10 thorpej Exp $ */
+/* $NetBSD: gpioiic.c,v 1.12 2023/05/10 00:08:30 riastradh Exp $ */
 /*     $OpenBSD: gpioiic.c,v 1.8 2008/11/24 12:12:12 mbalmer Exp $     */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gpioiic.c,v 1.11 2021/08/07 16:19:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpioiic.c,v 1.12 2023/05/10 00:08:30 riastradh Exp $");
 
 /*
  * I2C bus bit-banging through GPIO pins.
@@ -207,17 +207,16 @@ int
 gpioiic_detach(device_t self, int flags)
 {
        struct gpioiic_softc *sc = device_private(self);
-       int rv = 0;
-
-       if (sc->sc_i2c_dev != NULL)
-               rv = config_detach(sc->sc_i2c_dev, flags);
+       int error;
 
-       if (!rv) {
-               iic_tag_fini(&sc->sc_i2c_tag);
-               gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
-               pmf_device_deregister(self);
-       }
-       return rv;
+       error = config_detach_children(self, flags);
+       if (error)
+               return error;
+
+       iic_tag_fini(&sc->sc_i2c_tag);
+       gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
+       pmf_device_deregister(self);
+       return 0;
 }
 
 int



Home | Main Index | Thread Index | Old Index