Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The ulpt_detach function is the device_detach implementation for ulpt(4). Here is its function definition:
static int
ulpt_detach(device_t dev)
{
struct ulpt_softc *sc = device_get_softc(dev);
usb_fifo_detach(&sc->sc_fifo);
usb_fifo_detach(&sc->sc_fifo_no_reset);
mtx_lock(&sc->sc_mutex);
usb_callout_stop(&sc->sc_watchdog);
mtx_unlock(&sc->sc_mutex);
usbd_transfer_unsetup(sc->sc_transfer, ULPT_N_TRANSFER);
usb_callout_drain(&sc->sc_watchdog);
mtx_destroy(&sc->sc_mutex);
return (0);
}
This function starts by
destroying its device nodes. Then it
stops the callout function,
tears down the USB transfers,
drains the callout function, and
destroys its mutex.