Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144292372
D47969.id147647.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
20 KB
Referenced Files
None
Subscribers
None
D47969.id147647.diff
View Options
diff --git a/sys/arm/freescale/vybrid/vf_ehci.c b/sys/arm/freescale/vybrid/vf_ehci.c
--- a/sys/arm/freescale/vybrid/vf_ehci.c
+++ b/sys/arm/freescale/vybrid/vf_ehci.c
@@ -386,7 +386,7 @@
sc = &esc->base;
/* First detach all children; we can't detach if that fails. */
- if ((err = device_delete_children(dev)) != 0)
+ if ((err = bus_generic_detach(dev)) != 0)
return (err);
/*
diff --git a/sys/arm/mv/a37x0_spi.c b/sys/arm/mv/a37x0_spi.c
--- a/sys/arm/mv/a37x0_spi.c
+++ b/sys/arm/mv/a37x0_spi.c
@@ -227,7 +227,7 @@
int err;
struct a37x0_spi_softc *sc;
- if ((err = device_delete_children(dev)) != 0)
+ if ((err = bus_generic_detach(dev)) != 0)
return (err);
sc = device_get_softc(dev);
mtx_destroy(&sc->sc_mtx);
diff --git a/sys/arm/nvidia/tegra_ehci.c b/sys/arm/nvidia/tegra_ehci.c
--- a/sys/arm/nvidia/tegra_ehci.c
+++ b/sys/arm/nvidia/tegra_ehci.c
@@ -113,14 +113,17 @@
{
struct tegra_ehci_softc *sc;
ehci_softc_t *esc;
+ int error;
+
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
sc = device_get_softc(dev);
esc = &sc->ehci_softc;
if (sc->clk != NULL)
clk_release(sc->clk);
- if (esc->sc_bus.bdev != NULL)
- device_delete_child(dev, esc->sc_bus.bdev);
if (esc->sc_flags & EHCI_SCFLG_DONEINIT)
ehci_detach(esc);
if (esc->sc_intr_hdl != NULL)
@@ -135,9 +138,6 @@
if (sc->usb_alloc_called)
usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc);
- /* During module unload there are lots of children leftover. */
- device_delete_children(dev);
-
return (0);
}
diff --git a/sys/arm/nvidia/tegra_xhci.c b/sys/arm/nvidia/tegra_xhci.c
--- a/sys/arm/nvidia/tegra_xhci.c
+++ b/sys/arm/nvidia/tegra_xhci.c
@@ -916,12 +916,16 @@
{
struct tegra_xhci_softc *sc;
struct xhci_softc *xsc;
+ int error;
sc = device_get_softc(dev);
xsc = &sc->xhci_softc;
/* during module unload there are lots of children leftover */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
+
if (sc->xhci_inited) {
usb_callout_drain(&xsc->sc_callout);
xhci_halt_controller(xsc);
diff --git a/sys/arm/ti/am335x/am335x_musb.c b/sys/arm/ti/am335x/am335x_musb.c
--- a/sys/arm/ti/am335x/am335x_musb.c
+++ b/sys/arm/ti/am335x/am335x_musb.c
@@ -404,9 +404,12 @@
musbotg_detach(device_t dev)
{
struct musbotg_super_softc *sc = device_get_softc(dev);
+ int error;
/* during module unload there are lots of children leftover */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
if (sc->sc_otg.sc_irq_res && sc->sc_otg.sc_intr_hdl) {
/*
diff --git a/sys/arm/ti/usb/omap_ehci.c b/sys/arm/ti/usb/omap_ehci.c
--- a/sys/arm/ti/usb/omap_ehci.c
+++ b/sys/arm/ti/usb/omap_ehci.c
@@ -406,7 +406,9 @@
int err;
/* during module unload there are lots of children leftover */
- device_delete_children(dev);
+ err = bus_generic_detach(dev);
+ if (err != 0)
+ return (err);
/*
* disable interrupts that might have been switched on in ehci_init
diff --git a/sys/arm/ti/usb/omap_host.c b/sys/arm/ti/usb/omap_host.c
--- a/sys/arm/ti/usb/omap_host.c
+++ b/sys/arm/ti/usb/omap_host.c
@@ -432,9 +432,12 @@
omap_uhh_detach(device_t dev)
{
struct omap_uhh_softc *isc = device_get_softc(dev);
+ int error;
/* during module unload there are lots of children leftover */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
if (isc->uhh_mem_res) {
bus_release_resource(dev, SYS_RES_MEMORY, 0, isc->uhh_mem_res);
diff --git a/sys/arm/xilinx/zy7_ehci.c b/sys/arm/xilinx/zy7_ehci.c
--- a/sys/arm/xilinx/zy7_ehci.c
+++ b/sys/arm/xilinx/zy7_ehci.c
@@ -315,9 +315,12 @@
zy7_ehci_detach(device_t dev)
{
ehci_softc_t *sc = device_get_softc(dev);
+ int error;
/* during module unload there are lots of children leftover */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
if ((sc->sc_flags & EHCI_SCFLG_DONEINIT) != 0) {
ehci_detach(sc);
diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c
--- a/sys/dev/ahci/ahci.c
+++ b/sys/dev/ahci/ahci.c
@@ -391,10 +391,12 @@
ahci_detach(device_t dev)
{
struct ahci_controller *ctlr = device_get_softc(dev);
- int i;
+ int error, i;
/* Detach & delete all children */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
/* Free interrupts. */
for (i = 0; i < ctlr->numirqs; i++) {
diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c
--- a/sys/dev/ata/ata-pci.c
+++ b/sys/dev/ata/ata-pci.c
@@ -134,9 +134,12 @@
ata_pci_detach(device_t dev)
{
struct ata_pci_controller *ctlr = device_get_softc(dev);
+ int error;
/* detach & delete all children */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
if (ctlr->r_irq) {
bus_teardown_intr(dev, ctlr->r_irq, ctlr->handle);
diff --git a/sys/dev/atopcase/atopcase.c b/sys/dev/atopcase/atopcase.c
--- a/sys/dev/atopcase/atopcase.c
+++ b/sys/dev/atopcase/atopcase.c
@@ -545,7 +545,7 @@
{
int err;
- err = device_delete_children(sc->sc_dev);
+ err = bus_generic_detach(sc->sc_dev);
if (err)
return (err);
diff --git a/sys/dev/etherswitch/e6000sw/e6000sw.c b/sys/dev/etherswitch/e6000sw/e6000sw.c
--- a/sys/dev/etherswitch/e6000sw/e6000sw.c
+++ b/sys/dev/etherswitch/e6000sw/e6000sw.c
@@ -845,19 +845,21 @@
static int
e6000sw_detach(device_t dev)
{
- int phy;
+ int error, phy;
e6000sw_softc_t *sc;
sc = device_get_softc(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
+
if (device_is_attached(dev))
taskqueue_drain_timeout(sc->sc_tq, &sc->sc_tt);
if (sc->sc_tq != NULL)
taskqueue_free(sc->sc_tq);
- device_delete_children(dev);
-
sx_destroy(&sc->sx);
for (phy = 0; phy < sc->num_ports; phy++) {
if (sc->ifp[phy] != NULL)
diff --git a/sys/dev/hyperv/input/hv_hid.c b/sys/dev/hyperv/input/hv_hid.c
--- a/sys/dev/hyperv/input/hv_hid.c
+++ b/sys/dev/hyperv/input/hv_hid.c
@@ -457,7 +457,7 @@
int ret;
sc = device_get_softc(dev);
- ret = device_delete_children(dev);
+ ret = bus_generic_detach(dev);
if (ret != 0)
return (ret);
if (sc->hs_xact_ctx != NULL)
diff --git a/sys/dev/iicbus/iicbus.c b/sys/dev/iicbus/iicbus.c
--- a/sys/dev/iicbus/iicbus.c
+++ b/sys/dev/iicbus/iicbus.c
@@ -144,7 +144,7 @@
struct iicbus_softc *sc = IICBUS_SOFTC(dev);
int err;
- if ((err = device_delete_children(dev)) != 0)
+ if ((err = bus_generic_detach(dev)) != 0)
return (err);
iicbus_reset(dev, IIC_FASTEST, 0, NULL);
mtx_destroy(&sc->lock);
diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c
--- a/sys/dev/iicbus/iichid.c
+++ b/sys/dev/iicbus/iichid.c
@@ -1218,7 +1218,7 @@
int error;
sc = device_get_softc(dev);
- error = device_delete_children(dev);
+ error = bus_generic_detach(dev);
if (error)
return (error);
iichid_teardown_interrupt(sc);
diff --git a/sys/dev/intel/spi.c b/sys/dev/intel/spi.c
--- a/sys/dev/intel/spi.c
+++ b/sys/dev/intel/spi.c
@@ -550,9 +550,14 @@
intelspi_detach(device_t dev)
{
struct intelspi_softc *sc;
+ int error;
sc = device_get_softc(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
+
INTELSPI_LOCK_DESTROY(sc);
if (sc->sc_irq_ih)
@@ -566,7 +571,7 @@
bus_release_resource(dev, SYS_RES_IRQ,
sc->sc_irq_rid, sc->sc_irq_res);
- return (device_delete_children(dev));
+ return (0);
}
int
diff --git a/sys/dev/mmc/host/dwmmc.c b/sys/dev/mmc/host/dwmmc.c
--- a/sys/dev/mmc/host/dwmmc.c
+++ b/sys/dev/mmc/host/dwmmc.c
@@ -778,7 +778,7 @@
sc = device_get_softc(dev);
- ret = device_delete_children(dev);
+ ret = bus_generic_detach(dev);
if (ret != 0)
return (ret);
diff --git a/sys/dev/mvs/mvs_pci.c b/sys/dev/mvs/mvs_pci.c
--- a/sys/dev/mvs/mvs_pci.c
+++ b/sys/dev/mvs/mvs_pci.c
@@ -176,9 +176,12 @@
mvs_detach(device_t dev)
{
struct mvs_controller *ctlr = device_get_softc(dev);
+ int error;
/* Detach & delete all children */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
/* Free interrupt. */
if (ctlr->irq.r_irq) {
diff --git a/sys/dev/mvs/mvs_soc.c b/sys/dev/mvs/mvs_soc.c
--- a/sys/dev/mvs/mvs_soc.c
+++ b/sys/dev/mvs/mvs_soc.c
@@ -180,9 +180,12 @@
mvs_detach(device_t dev)
{
struct mvs_controller *ctlr = device_get_softc(dev);
+ int error;
/* Detach & delete all children */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
/* Free interrupt. */
if (ctlr->irq.r_irq) {
diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c
--- a/sys/dev/neta/if_mvneta.c
+++ b/sys/dev/neta/if_mvneta.c
@@ -843,7 +843,7 @@
for (q = 0; q < MVNETA_TX_QNUM_MAX; q++)
mvneta_ring_dealloc_tx_queue(sc, q);
- device_delete_children(dev);
+ bus_generic_detach(dev);
if (sc->ih_cookie[0] != NULL)
bus_teardown_intr(dev, sc->res[1], sc->ih_cookie[0]);
diff --git a/sys/dev/ow/owc_gpiobus.c b/sys/dev/ow/owc_gpiobus.c
--- a/sys/dev/ow/owc_gpiobus.c
+++ b/sys/dev/ow/owc_gpiobus.c
@@ -146,7 +146,7 @@
sc = device_get_softc(dev);
- if ((err = device_delete_children(dev)) != 0)
+ if ((err = bus_generic_detach(dev)) != 0)
return (err);
gpio_pin_release(sc->sc_pin);
diff --git a/sys/dev/p2sb/p2sb.c b/sys/dev/p2sb/p2sb.c
--- a/sys/dev/p2sb/p2sb.c
+++ b/sys/dev/p2sb/p2sb.c
@@ -159,9 +159,13 @@
p2sb_detach(device_t dev)
{
struct p2sb_softc *sc;
+ int error;
/* Teardown the state in our softc created in our attach routine. */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
+
sc = device_get_softc(dev);
mtx_destroy(&sc->mutex);
if (sc->res != NULL)
diff --git a/sys/dev/ppc/ppc.c b/sys/dev/ppc/ppc.c
--- a/sys/dev/ppc/ppc.c
+++ b/sys/dev/ppc/ppc.c
@@ -1815,13 +1815,16 @@
ppc_detach(device_t dev)
{
struct ppc_data *ppc = DEVTOSOFTC(dev);
+ int error;
if (ppc->res_irq == 0) {
return (ENXIO);
}
/* detach & delete all children */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
if (ppc->res_irq != 0) {
bus_teardown_intr(dev, ppc->res_irq, ppc->intr_cookie);
diff --git a/sys/dev/rtsx/rtsx.c b/sys/dev/rtsx/rtsx.c
--- a/sys/dev/rtsx/rtsx.c
+++ b/sys/dev/rtsx/rtsx.c
@@ -3784,10 +3784,10 @@
WRITE4(sc, RTSX_BIER, sc->rtsx_intr_enabled);
/* Stop device. */
- error = device_delete_children(sc->rtsx_dev);
+ error = bus_generic_detach(sc->rtsx_dev);
+ if (error)
+ return (error);
sc->rtsx_mmc_dev = NULL;
- if (error)
- return (error);
taskqueue_drain_timeout(taskqueue_swi_giant, &sc->rtsx_card_insert_task);
taskqueue_drain(taskqueue_swi_giant, &sc->rtsx_card_remove_task);
diff --git a/sys/dev/siis/siis.c b/sys/dev/siis/siis.c
--- a/sys/dev/siis/siis.c
+++ b/sys/dev/siis/siis.c
@@ -203,9 +203,12 @@
siis_detach(device_t dev)
{
struct siis_controller *ctlr = device_get_softc(dev);
+ int error;
/* Detach & delete all children */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
/* Free interrupts. */
if (ctlr->irq.r_irq) {
diff --git a/sys/dev/sound/pci/hda/hdaa.c b/sys/dev/sound/pci/hda/hdaa.c
--- a/sys/dev/sound/pci/hda/hdaa.c
+++ b/sys/dev/sound/pci/hda/hdaa.c
@@ -6684,7 +6684,7 @@
struct hdaa_devinfo *devinfo = device_get_softc(dev);
int error;
- if ((error = device_delete_children(dev)) != 0)
+ if ((error = bus_generic_detach(dev)) != 0)
return (error);
hdaa_lock(devinfo);
diff --git a/sys/dev/sound/pci/hda/hdacc.c b/sys/dev/sound/pci/hda/hdacc.c
--- a/sys/dev/sound/pci/hda/hdacc.c
+++ b/sys/dev/sound/pci/hda/hdacc.c
@@ -541,7 +541,7 @@
struct hdacc_softc *codec = device_get_softc(dev);
int error;
- if ((error = device_delete_children(dev)) != 0)
+ if ((error = bus_generic_detach(dev)) != 0)
return (error);
free(codec->fgs, M_HDACC);
return (0);
diff --git a/sys/dev/sound/pci/hdsp.c b/sys/dev/sound/pci/hdsp.c
--- a/sys/dev/sound/pci/hdsp.c
+++ b/sys/dev/sound/pci/hdsp.c
@@ -985,7 +985,7 @@
return (0);
}
- err = device_delete_children(dev);
+ err = bus_generic_detach(dev);
if (err)
return (err);
diff --git a/sys/dev/sound/pci/hdspe.c b/sys/dev/sound/pci/hdspe.c
--- a/sys/dev/sound/pci/hdspe.c
+++ b/sys/dev/sound/pci/hdspe.c
@@ -877,7 +877,7 @@
return (0);
}
- err = device_delete_children(dev);
+ err = bus_generic_detach(dev);
if (err)
return (err);
diff --git a/sys/dev/spibus/spibus.c b/sys/dev/spibus/spibus.c
--- a/sys/dev/spibus/spibus.c
+++ b/sys/dev/spibus/spibus.c
@@ -68,7 +68,7 @@
int
spibus_detach(device_t dev)
{
- return (device_delete_children(dev));
+ return (bus_generic_detach(dev));
}
static int
diff --git a/sys/dev/usb/controller/dwc_otg_acpi.c b/sys/dev/usb/controller/dwc_otg_acpi.c
--- a/sys/dev/usb/controller/dwc_otg_acpi.c
+++ b/sys/dev/usb/controller/dwc_otg_acpi.c
@@ -127,9 +127,12 @@
dwc_otg_detach(device_t dev)
{
struct dwc_otg_softc *sc = device_get_softc(dev);
+ int error;
/* during module unload there are lots of children leftover */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
if (sc->sc_irq_res && sc->sc_intr_hdl) {
/*
diff --git a/sys/dev/usb/controller/dwc_otg_fdt.c b/sys/dev/usb/controller/dwc_otg_fdt.c
--- a/sys/dev/usb/controller/dwc_otg_fdt.c
+++ b/sys/dev/usb/controller/dwc_otg_fdt.c
@@ -162,9 +162,12 @@
dwc_otg_detach(device_t dev)
{
struct dwc_otg_fdt_softc *sc = device_get_softc(dev);
+ int error;
/* during module unload there are lots of children leftover */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
if (sc->sc_otg.sc_irq_res && sc->sc_otg.sc_intr_hdl) {
/*
diff --git a/sys/dev/usb/controller/ehci_fsl.c b/sys/dev/usb/controller/ehci_fsl.c
--- a/sys/dev/usb/controller/ehci_fsl.c
+++ b/sys/dev/usb/controller/ehci_fsl.c
@@ -372,10 +372,14 @@
static int
fsl_ehci_detach(device_t self)
{
-
int err;
ehci_softc_t *sc;
+ /* During module unload there are lots of children leftover */
+ err = bus_generic_detach(self);
+ if (err != 0)
+ return (err);
+
sc = device_get_softc(self);
/*
* only call ehci_detach() after ehci_init()
@@ -399,14 +403,6 @@
sc->sc_intr_hdl = NULL;
}
- if (sc->sc_bus.bdev) {
- device_delete_child(self, sc->sc_bus.bdev);
- sc->sc_bus.bdev = NULL;
- }
-
- /* During module unload there are lots of children leftover */
- device_delete_children(self);
-
if (sc->sc_irq_res) {
bus_release_resource(self, SYS_RES_IRQ, 0, sc->sc_irq_res);
sc->sc_irq_res = NULL;
diff --git a/sys/dev/usb/controller/ehci_imx.c b/sys/dev/usb/controller/ehci_imx.c
--- a/sys/dev/usb/controller/ehci_imx.c
+++ b/sys/dev/usb/controller/ehci_imx.c
@@ -314,7 +314,7 @@
esc = &sc->ehci_softc;
/* First detach all children; we can't detach if that fails. */
- if ((err = device_delete_children(dev)) != 0)
+ if ((err = bus_generic_detach(dev)) != 0)
return (err);
if (esc->sc_flags & EHCI_SCFLG_DONEINIT)
diff --git a/sys/dev/usb/controller/ehci_msm.c b/sys/dev/usb/controller/ehci_msm.c
--- a/sys/dev/usb/controller/ehci_msm.c
+++ b/sys/dev/usb/controller/ehci_msm.c
@@ -171,13 +171,9 @@
sc = device_get_softc(dev);
- if (sc->sc_bus.bdev) {
- bdev = sc->sc_bus.bdev;
- device_detach(bdev);
- device_delete_child(dev, bdev);
- }
-
- device_delete_children(dev);
+ err = bus_generic_detach(dev);
+ if (err != 0)
+ return (err);
if (sc->sc_irq_res && sc->sc_intr_hdl) {
/* only call ehci_detach() after ehci_init() */
diff --git a/sys/dev/usb/controller/ehci_mv.c b/sys/dev/usb/controller/ehci_mv.c
--- a/sys/dev/usb/controller/ehci_mv.c
+++ b/sys/dev/usb/controller/ehci_mv.c
@@ -283,7 +283,9 @@
int err;
/* during module unload there are lots of children leftover */
- device_delete_children(self);
+ err = bus_generic_detach(self);
+ if (err != 0)
+ return (err);
/*
* disable interrupts that might have been switched on in mv_ehci_attach
diff --git a/sys/dev/usb/controller/ehci_pci.c b/sys/dev/usb/controller/ehci_pci.c
--- a/sys/dev/usb/controller/ehci_pci.c
+++ b/sys/dev/usb/controller/ehci_pci.c
@@ -505,9 +505,12 @@
ehci_pci_detach(device_t self)
{
ehci_softc_t *sc = device_get_softc(self);
+ int error;
/* during module unload there are lots of children leftover */
- device_delete_children(self);
+ error = bus_generic_detach(self);
+ if (error != 0)
+ return (error);
pci_disable_busmaster(self);
diff --git a/sys/dev/usb/controller/generic_ehci.c b/sys/dev/usb/controller/generic_ehci.c
--- a/sys/dev/usb/controller/generic_ehci.c
+++ b/sys/dev/usb/controller/generic_ehci.c
@@ -139,7 +139,9 @@
int err;
/* during module unload there are lots of children leftover */
- device_delete_children(self);
+ err = bus_generic_detach(self);
+ if (err != 0)
+ return (err);
if (sc->sc_irq_res && sc->sc_intr_hdl) {
/*
diff --git a/sys/dev/usb/controller/generic_ohci.c b/sys/dev/usb/controller/generic_ohci.c
--- a/sys/dev/usb/controller/generic_ohci.c
+++ b/sys/dev/usb/controller/generic_ohci.c
@@ -231,7 +231,9 @@
struct hwrst_list *rst, *rst_tmp;
/* during module unload there are lots of children leftover */
- device_delete_children(dev);
+ err = bus_generic_detach(dev);
+ if (err != 0)
+ return (err);
/*
* Put the controller into reset, then disable clocks and do
diff --git a/sys/dev/usb/controller/generic_xhci.c b/sys/dev/usb/controller/generic_xhci.c
--- a/sys/dev/usb/controller/generic_xhci.c
+++ b/sys/dev/usb/controller/generic_xhci.c
@@ -152,7 +152,9 @@
int err;
/* during module unload there are lots of children leftover */
- device_delete_children(dev);
+ err = bus_generic_detach(dev);
+ if (err != 0)
+ return (err);
if (sc->sc_irq_res != NULL && sc->sc_intr_hdl != NULL) {
err = bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intr_hdl);
diff --git a/sys/dev/usb/controller/musb_otg_allwinner.c b/sys/dev/usb/controller/musb_otg_allwinner.c
--- a/sys/dev/usb/controller/musb_otg_allwinner.c
+++ b/sys/dev/usb/controller/musb_otg_allwinner.c
@@ -561,17 +561,14 @@
awusbdrd_detach(device_t dev)
{
struct awusbdrd_softc *sc;
- device_t bdev;
int error;
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
+
sc = device_get_softc(dev);
- if (sc->sc.sc_bus.bdev != NULL) {
- bdev = sc->sc.sc_bus.bdev;
- device_detach(bdev);
- device_delete_child(dev, bdev);
- }
-
musbotg_uninit(&sc->sc);
error = bus_teardown_intr(dev, sc->res[1], sc->sc.sc_intr_hdl);
if (error != 0)
@@ -594,8 +591,6 @@
bus_release_resources(dev, awusbdrd_spec, sc->res);
- device_delete_children(dev);
-
return (0);
}
diff --git a/sys/dev/usb/controller/ohci_pci.c b/sys/dev/usb/controller/ohci_pci.c
--- a/sys/dev/usb/controller/ohci_pci.c
+++ b/sys/dev/usb/controller/ohci_pci.c
@@ -320,9 +320,12 @@
ohci_pci_detach(device_t self)
{
ohci_softc_t *sc = device_get_softc(self);
+ int error;
/* during module unload there are lots of children leftover */
- device_delete_children(self);
+ error = bus_generic_detach(self);
+ if (error != 0)
+ return (error);
pci_disable_busmaster(self);
diff --git a/sys/dev/usb/controller/uhci_pci.c b/sys/dev/usb/controller/uhci_pci.c
--- a/sys/dev/usb/controller/uhci_pci.c
+++ b/sys/dev/usb/controller/uhci_pci.c
@@ -414,9 +414,12 @@
uhci_pci_detach(device_t self)
{
uhci_softc_t *sc = device_get_softc(self);
+ int error;
/* during module unload there are lots of children leftover */
- device_delete_children(self);
+ error = bus_generic_detach(self);
+ if (error != 0)
+ return (error);
/*
* disable interrupts that might have been switched on in
diff --git a/sys/dev/usb/controller/xhci_pci.c b/sys/dev/usb/controller/xhci_pci.c
--- a/sys/dev/usb/controller/xhci_pci.c
+++ b/sys/dev/usb/controller/xhci_pci.c
@@ -465,9 +465,12 @@
xhci_pci_detach(device_t self)
{
struct xhci_softc *sc = device_get_softc(self);
+ int error;
/* during module unload there are lots of children leftover */
- device_delete_children(self);
+ error = bus_generic_detach(self);
+ if (error != 0)
+ return (error);
usb_callout_drain(&sc->sc_callout);
xhci_halt_controller(sc);
diff --git a/sys/dev/usb/input/usbhid.c b/sys/dev/usb/input/usbhid.c
--- a/sys/dev/usb/input/usbhid.c
+++ b/sys/dev/usb/input/usbhid.c
@@ -851,8 +851,12 @@
usbhid_detach(device_t dev)
{
struct usbhid_softc *sc = device_get_softc(dev);
+ int error;
+
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
- device_delete_children(dev);
mtx_destroy(&sc->sc_mtx);
return (0);
diff --git a/sys/dev/usb/video/udl.c b/sys/dev/usb/video/udl.c
--- a/sys/dev/usb/video/udl.c
+++ b/sys/dev/usb/video/udl.c
@@ -441,9 +441,12 @@
udl_detach(device_t dev)
{
struct udl_softc *sc = device_get_softc(dev);
+ int error;
/* delete all child devices */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
UDL_LOCK(sc);
sc->sc_gone = 1;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 8, 4:38 PM (13 m, 46 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28474365
Default Alt Text
D47969.id147647.diff (20 KB)
Attached To
Mode
D47969: Use bus_generic_detach instead of device_delete_children in detach
Attached
Detach File
Event Timeline
Log In to Comment