diff --git a/sys/dev/pcmcia/pcmcom.c b/sys/dev/pcmcia/pcmcom.c index 9166c1ac8e17..c291f12c857d 100644 --- a/sys/dev/pcmcia/pcmcom.c +++ b/sys/dev/pcmcia/pcmcom.c @@ -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 -__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 #include @@ -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