static int musbotg_detach(device_t dev) { struct musbotg_super_softc *sc = device_get_softc(dev); int err; /* during module unload there are lots of children leftover */ device_delete_children(dev); if (sc->sc_otg.sc_irq_res && sc->sc_otg.sc_intr_hdl) { /* * only call musbotg_uninit() after musbotg_init() */ musbotg_uninit(&sc->sc_otg); err = bus_teardown_intr(dev, sc->sc_otg.sc_irq_res, sc->sc_otg.sc_intr_hdl); sc->sc_otg.sc_intr_hdl = NULL; } /* free IRQ channel, if any */ if (sc->sc_otg.sc_irq_res) { bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_otg.sc_irq_res); sc->sc_otg.sc_irq_res = NULL; } /* free memory resource, if any */ if (sc->sc_otg.sc_io_res) { bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_otg.sc_io_res); sc->sc_otg.sc_io_res = NULL; } usb_bus_mem_free_all(&sc->sc_otg.sc_bus, NULL); return (0); }
static int musbotg_detach(device_t dev) { struct musbotg_super_softc *sc = device_get_softc(dev); int err; /* during module unload there are lots of children leftover */ device_delete_children(dev); if (sc->sc_otg.sc_irq_res && sc->sc_otg.sc_intr_hdl) { /* * only call musbotg_uninit() after musbotg_init() */ musbotg_uninit(&sc->sc_otg); err = bus_teardown_intr(dev, sc->sc_otg.sc_irq_res, sc->sc_otg.sc_intr_hdl); sc->sc_otg.sc_intr_hdl = NULL; } usb_bus_mem_free_all(&sc->sc_otg.sc_bus, NULL); /* Free resources if any */ if (sc->sc_mem_res[0]) bus_release_resources(dev, am335x_musbotg_mem_spec, sc->sc_mem_res); if (sc->sc_otg.sc_irq_res) bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, sc->sc_otg.sc_irq_res); return (0); }
static int musbotg_shutdown(device_t dev) { struct musbotg_super_softc *sc = device_get_softc(dev); int err; err = bus_generic_shutdown(dev); if (err) return (err); musbotg_uninit(&sc->sc_otg); return (0); }
static int musbotg_detach(device_t dev) { struct musbotg_super_softc *sc = device_get_softc(dev); device_t bdev; int err; int i; for (i = 0; i < AM335X_USB_PORTS; i++) { if (sc->sc_otg[i].sc_bus.bdev) { bdev = sc->sc_otg[i].sc_bus.bdev; device_detach(bdev); device_delete_child(dev, bdev); } if (sc->sc_otg[i].sc_irq_res && sc->sc_otg[i].sc_intr_hdl) { /* * only call musbotg_uninit() after musbotg_init() */ musbotg_uninit(&sc->sc_otg[i]); err = bus_teardown_intr(dev, sc->sc_otg[i].sc_irq_res, sc->sc_otg[i].sc_intr_hdl); sc->sc_otg[i].sc_intr_hdl = NULL; } usb_bus_mem_free_all(&sc->sc_otg[i].sc_bus, NULL); } if (sc->sc_intr_hdl) { bus_teardown_intr(dev, sc->sc_irq_res[0], sc->sc_intr_hdl); sc->sc_intr_hdl = NULL; } /* Free resources if any */ if (sc->sc_mem_res[0]) bus_release_resources(dev, am335x_musbotg_mem_spec, sc->sc_mem_res); if (sc->sc_irq_res[0]) bus_release_resources(dev, am335x_musbotg_irq_spec, sc->sc_irq_res); /* during module unload there are lots of children leftover */ device_delete_children(dev); return (0); }