aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/controller/ehci_fsl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/usb/controller/ehci_fsl.c')
-rw-r--r--sys/dev/usb/controller/ehci_fsl.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/sys/dev/usb/controller/ehci_fsl.c b/sys/dev/usb/controller/ehci_fsl.c
index 668a5b44e4c3..ce1749775ab2 100644
--- a/sys/dev/usb/controller/ehci_fsl.c
+++ b/sys/dev/usb/controller/ehci_fsl.c
@@ -26,7 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include "opt_bus.h"
#include <sys/param.h>
@@ -306,7 +305,7 @@ fsl_ehci_attach(device_t self)
}
/* Add USB device */
- sc->sc_bus.bdev = device_add_child(self, "usbus", -1);
+ sc->sc_bus.bdev = device_add_child(self, "usbus", DEVICE_UNIT_ANY);
if (!sc->sc_bus.bdev) {
device_printf(self, "Could not add USB device\n");
err = fsl_ehci_detach(self);
@@ -372,10 +371,14 @@ fsl_ehci_attach(device_t self)
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 +402,6 @@ fsl_ehci_detach(device_t self)
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;