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

Modified Files:
        src/sys/arch/x86/pci/imcsmb: imc.c imcsmb.c

Log Message:
x86/imc(4): Use config_detach_children.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/pci/imcsmb/imc.c \
    src/sys/arch/x86/pci/imcsmb/imcsmb.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/arch/x86/pci/imcsmb/imc.c
diff -u src/sys/arch/x86/pci/imcsmb/imc.c:1.5 src/sys/arch/x86/pci/imcsmb/imc.c:1.6
--- src/sys/arch/x86/pci/imcsmb/imc.c:1.5	Wed Sep 28 10:09:48 2022
+++ src/sys/arch/x86/pci/imcsmb/imc.c	Wed May 10 00:07:49 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: imc.c,v 1.5 2022/09/28 10:09:48 msaitoh Exp $ */
+/* $NetBSD: imc.c,v 1.6 2023/05/10 00:07:49 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.5 2022/09/28 10:09:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.6 2023/05/10 00:07:49 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -259,16 +259,11 @@ imc_rescan(device_t self, const char *if
 static int
 imc_detach(device_t self, int flags)
 {
-	struct imc_softc *sc = device_private(self);
-	int i, error;
+	int error;
 
-	for (i = 0; i < 2; i++) {
-		if (sc->sc_smbchild[i] != NULL) {
-			error = config_detach(sc->sc_smbchild[i], flags);     
-			if (error)
-				return error;
-		}
-	}
+	error = config_detach_children(self, flags);
+	if (error)
+		return error;
 
 	pmf_device_deregister(self);
 	return 0;
Index: src/sys/arch/x86/pci/imcsmb/imcsmb.c
diff -u src/sys/arch/x86/pci/imcsmb/imcsmb.c:1.5 src/sys/arch/x86/pci/imcsmb/imcsmb.c:1.6
--- src/sys/arch/x86/pci/imcsmb/imcsmb.c:1.5	Sat Aug  7 16:19:08 2021
+++ src/sys/arch/x86/pci/imcsmb/imcsmb.c	Wed May 10 00:07:49 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: imcsmb.c,v 1.5 2021/08/07 16:19:08 thorpej Exp $ */
+/* $NetBSD: imcsmb.c,v 1.6 2023/05/10 00:07:49 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imcsmb.c,v 1.5 2021/08/07 16:19:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imcsmb.c,v 1.6 2023/05/10 00:07:49 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -182,14 +182,12 @@ imcsmb_chdet(device_t self, device_t chi
 static int
 imcsmb_detach(device_t self, int flags)
 {
-	int error;
 	struct imcsmb_softc *sc = device_private(self);
+	int error;
 
-	if (sc->sc_smbus != NULL) {
-		error = config_detach(sc->sc_smbus, flags);
-		if (error)
-			return error;
-	}
+	error = config_detach_children(self, flags);
+	if (error)
+		return error;
 
 	pmf_device_deregister(self);
 	iic_tag_fini(&sc->sc_i2c_tag);

Reply via email to