Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/6e5280afb9d6
branches:  trunk
changeset: 374690:6e5280afb9d6
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed May 10 00:09:31 2023 +0000

description:
gpioow(4): Use config_detach_children.

diffstat:

 sys/dev/gpio/gpioow.c |  21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diffs (43 lines):

diff -r 9deed573b8dd -r 6e5280afb9d6 sys/dev/gpio/gpioow.c
--- a/sys/dev/gpio/gpioow.c     Wed May 10 00:08:30 2023 +0000
+++ b/sys/dev/gpio/gpioow.c     Wed May 10 00:09:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpioow.c,v 1.19 2021/08/07 16:19:10 thorpej Exp $ */
+/* $NetBSD: gpioow.c,v 1.20 2023/05/10 00:09:31 riastradh Exp $ */
 /*     $OpenBSD: gpioow.c,v 1.1 2006/03/04 16:27:03 grange Exp $       */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gpioow.c,v 1.19 2021/08/07 16:19:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpioow.c,v 1.20 2023/05/10 00:09:31 riastradh Exp $");
 
 /*
  * 1-Wire bus bit-banging through GPIO pin.
@@ -162,16 +162,15 @@ static int
 gpioow_detach(device_t self, int flags)
 {
        struct gpioow_softc *sc = device_private(self);
-       int rv = 0;
-
-       if (sc->sc_ow_dev != NULL)
-               rv = config_detach(sc->sc_ow_dev, flags);
+       int error;
 
-       if (!rv) {
-               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;
+
+       gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
+       pmf_device_deregister(self);
+       return 0;
 }
 
 static int



Home | Main Index | Thread Index | Old Index