git: e9d3857040a1 - main - Use bus_detach_children instead of bus_generic_detach

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 02 Jan 2025 18:28:16 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=e9d3857040a1983f6cf8780783da4da34773f660

commit e9d3857040a1983f6cf8780783da4da34773f660
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-01-02 18:19:39 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-01-02 18:19:39 +0000

    Use bus_detach_children instead of bus_generic_detach
    
    These drivers perform additional teardown steps in between detaching
    child devices and deleting child devices.
    
    Differential Revision:  https://reviews.freebsd.org/D47957
---
 sys/arm/nvidia/tegra_sdhci.c | 2 +-
 sys/dev/cxgb/cxgb_main.c     | 4 ++--
 sys/dev/cxgbe/t4_main.c      | 2 +-
 sys/dev/gpio/gpiobus.c       | 2 +-
 sys/dev/gpio/gpioiic.c       | 2 +-
 sys/dev/pci/pci_pci.c        | 2 +-
 sys/dev/sdhci/sdhci_fdt.c    | 2 +-
 sys/dev/sdhci/sdhci_xenon.c  | 2 +-
 8 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/sys/arm/nvidia/tegra_sdhci.c b/sys/arm/nvidia/tegra_sdhci.c
index 4d2eaccf4c27..3bd9a9bb4632 100644
--- a/sys/arm/nvidia/tegra_sdhci.c
+++ b/sys/arm/nvidia/tegra_sdhci.c
@@ -418,7 +418,7 @@ tegra_sdhci_detach(device_t dev)
 	struct tegra_sdhci_softc *sc = device_get_softc(dev);
 	struct sdhci_slot *slot = &sc->slot;
 
-	bus_generic_detach(dev);
+	bus_detach_children(dev);
 	sdhci_fdt_gpio_teardown(sc->gpio);
 	clk_release(sc->clk);
 	bus_teardown_intr(dev, sc->irq_res, sc->intr_cookie);
diff --git a/sys/dev/cxgb/cxgb_main.c b/sys/dev/cxgb/cxgb_main.c
index ed0993f934f1..a19483c7cbbf 100644
--- a/sys/dev/cxgb/cxgb_main.c
+++ b/sys/dev/cxgb/cxgb_main.c
@@ -729,7 +729,7 @@ cxgb_free(struct adapter *sc)
 	/*
 	 * Make sure all child devices are gone.
 	 */
-	bus_generic_detach(sc->dev);
+	bus_detach_children(sc->dev);
 	for (i = 0; i < (sc)->params.nports; i++) {
 		if (sc->portdev[i] &&
 		    device_delete_child(sc->dev, sc->portdev[i]) != 0)
@@ -1066,7 +1066,7 @@ cxgb_port_attach(device_t dev)
 
 /*
  * cxgb_port_detach() is called via the device_detach methods when
- * cxgb_free() calls the bus_generic_detach.  It is responsible for 
+ * cxgb_free() calls the bus_detach_children.  It is responsible for 
  * removing the device from the view of the kernel, i.e. from all 
  * interfaces lists etc.  This routine is only called when the driver is 
  * being unloaded, not when the link goes down.
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 25d5dee8b781..755fd19a3c9c 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -1789,7 +1789,7 @@ t4_detach_common(device_t dev)
 	}
 
 	if (device_is_attached(dev)) {
-		rc = bus_generic_detach(dev);
+		rc = bus_detach_children(dev);
 		if (rc) {
 			device_printf(dev,
 			    "failed to detach child devices: %d\n", rc);
diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c
index bc166f43d398..37371fa4e1cc 100644
--- a/sys/dev/gpio/gpiobus.c
+++ b/sys/dev/gpio/gpiobus.c
@@ -582,7 +582,7 @@ gpiobus_detach(device_t dev)
 	    ("gpiobus mutex not initialized"));
 	GPIOBUS_LOCK_DESTROY(sc);
 
-	if ((err = bus_generic_detach(dev)) != 0)
+	if ((err = bus_detach_children(dev)) != 0)
 		return (err);
 	if ((err = device_delete_children(dev)) != 0)
 		return (err);
diff --git a/sys/dev/gpio/gpioiic.c b/sys/dev/gpio/gpioiic.c
index 2404e70fc648..2197d238cf2b 100644
--- a/sys/dev/gpio/gpioiic.c
+++ b/sys/dev/gpio/gpioiic.c
@@ -331,7 +331,7 @@ gpioiic_detach(device_t dev)
 	struct gpioiic_softc *sc = device_get_softc(dev);
 	int err;
 
-	if ((err = bus_generic_detach(dev)) != 0)
+	if ((err = bus_detach_children(dev)) != 0)
 		return (err);
 
 	gpioiic_cleanup(sc);
diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c
index c4f7814dfee5..44cbf327868c 100644
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -1552,7 +1552,7 @@ pcib_detach(device_t dev)
 	int error;
 
 	sc = device_get_softc(dev);
-	error = bus_generic_detach(dev);
+	error = bus_detach_children(dev);
 	if (error)
 		return (error);
 #ifdef PCI_HP
diff --git a/sys/dev/sdhci/sdhci_fdt.c b/sys/dev/sdhci/sdhci_fdt.c
index e7dda316539c..1d8013ee7088 100644
--- a/sys/dev/sdhci/sdhci_fdt.c
+++ b/sys/dev/sdhci/sdhci_fdt.c
@@ -666,7 +666,7 @@ sdhci_fdt_detach(device_t dev)
 	struct sdhci_fdt_softc *sc = device_get_softc(dev);
 	int i;
 
-	bus_generic_detach(dev);
+	bus_detach_children(dev);
 	bus_teardown_intr(dev, sc->irq_res, sc->intrhand);
 	bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq_res),
 	    sc->irq_res);
diff --git a/sys/dev/sdhci/sdhci_xenon.c b/sys/dev/sdhci/sdhci_xenon.c
index 4a823b896ca8..098412a81148 100644
--- a/sys/dev/sdhci/sdhci_xenon.c
+++ b/sys/dev/sdhci/sdhci_xenon.c
@@ -592,7 +592,7 @@ sdhci_xenon_detach(device_t dev)
 {
 	struct sdhci_xenon_softc *sc = device_get_softc(dev);
 
-	bus_generic_detach(dev);
+	bus_detach_children(dev);
 	bus_teardown_intr(dev, sc->irq_res, sc->intrhand);
 	bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq_res),
 	    sc->irq_res);