Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Tying Everything Together > ulpt_detach Function

ulpt_detach Function

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.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial