pcmcom(4): Use config_detach_children.

This commit is contained in:
riastradh 2023-05-10 00:12:12 +00:00
parent 0594648075
commit 5cd5d6b9b9
1 changed files with 9 additions and 16 deletions

View File

@ -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