| 137 | } |
| 138 | |
| 139 | static int |
| 140 | dotg_fdt_detach(device_t dev) |
| 141 | { |
| 142 | struct dwc_otg_softc *sc = device_get_softc(dev); |
| 143 | int err; |
| 144 | |
| 145 | /* during module unload there are lots of children leftover */ |
| 146 | device_delete_children(dev); |
| 147 | |
| 148 | if (sc->sc_irq_res && sc->sc_intr_hdl) { |
| 149 | /* |
| 150 | * only call dotg_fdt_uninit() after dotg_fdt_init() |
| 151 | */ |
| 152 | dwc_otg_uninit(sc); |
| 153 | |
| 154 | err = bus_teardown_intr(dev, sc->sc_irq_res, |
| 155 | sc->sc_intr_hdl); |
| 156 | sc->sc_intr_hdl = NULL; |
| 157 | } |
| 158 | if (sc->sc_irq_res) { |
| 159 | bus_release_resource(dev, SYS_RES_IRQ, 0, |
| 160 | sc->sc_irq_res); |
| 161 | sc->sc_irq_res = NULL; |
| 162 | } |
| 163 | if (sc->sc_io_res) { |
| 164 | bus_release_resource(dev, SYS_RES_MEMORY, 0, |
| 165 | sc->sc_io_res); |
| 166 | sc->sc_io_res = NULL; |
| 167 | } |
| 168 | usb_bus_mem_free_all(&sc->sc_bus, NULL); |
| 169 | |
| 170 | return (0); |
| 171 | } |
| 172 | |
| 173 | static device_method_t dotg_fdt_methods[] = { |
| 174 | /* Device interface */ |
no test coverage detected