Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pcmcia pcmcom(4): Use config_detach_children.



details:   https://anonhg.NetBSD.org/src/rev/209148ea5247
branches:  trunk
changeset: 374705:209148ea5247
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed May 10 00:12:12 2023 +0000

description:
pcmcom(4): Use config_detach_children.

diffstat:

 sys/dev/pcmcia/pcmcom.c |  25 +++++++++----------------
 1 files changed, 9 insertions(+), 16 deletions(-)

diffs (49 lines):

diff -r 17e6e47f51e0 -r 209148ea5247 sys/dev/pcmcia/pcmcom.c
--- a/sys/dev/pcmcia/pcmcom.c   Wed May 10 00:12:05 2023 +0000
+++ b/sys/dev/pcmcia/pcmcom.c   Wed May 10 00:12:12 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcmcom.c,v 1.44 2022/09/25 21:53:54 thorpej Exp $      */
+/*     $NetBSD: pcmcom.c,v 1.45 2023/05/10 00:12:12 riastradh Exp $    */
 
 /*-
  * Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcmcom.c,v 1.44 2022/09/25 21:53:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcmcom.c,v 1.45 2023/05/10 00:12:12 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -202,23 +202,16 @@ int
 pcmcom_detach(device_t self, int flags)
 {
        struct pcmcom_softc *sc = device_private(self);
-       int slave, error;
+       int error;
+
+       error = config_detach_children(self, flags);
+       if (error)
+               return error;
 
        if (sc->sc_state != PCMCOM_ATTACHED)
-               return (0);
-
-       for (slave = sc->sc_nslaves - 1; slave >= 0; slave--) {
-               if (sc->sc_slaves[slave]) {
-                       /* Detach the child. */
-                       error = config_detach(sc->sc_slaves[slave], flags);
-                       if (error)
-                               return (error);
-               }
-       }
-
+               return 0;
        pcmcia_function_unconfigure(sc->sc_pf);
-
-       return (0);
+       return 0;
 }
 
 int



Home | Main Index | Thread Index | Old Index