Module Name:    src
Committed By:   riastradh
Date:           Wed May 10 00:12:12 UTC 2023

Modified Files:
        src/sys/dev/pcmcia: pcmcom.c

Log Message:
pcmcom(4): Use config_detach_children.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/pcmcia/pcmcom.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pcmcia/pcmcom.c
diff -u src/sys/dev/pcmcia/pcmcom.c:1.44 src/sys/dev/pcmcia/pcmcom.c:1.45
--- src/sys/dev/pcmcia/pcmcom.c:1.44	Sun Sep 25 21:53:54 2022
+++ src/sys/dev/pcmcia/pcmcom.c	Wed May 10 00:12:12 2023
@@ -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;
-
-	if (sc->sc_state != PCMCOM_ATTACHED)
-		return (0);
+	int error;
 
-	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);
-		}
-	}
+	error = config_detach_children(self, flags);
+	if (error)
+		return error;
 
+	if (sc->sc_state != PCMCOM_ATTACHED)
+		return 0;
 	pcmcia_function_unconfigure(sc->sc_pf);
-
-	return (0);
+	return 0;
 }
 
 int

Reply via email to