NAME
usbd_ref_incr
,
usbd_ref_decr
, usbd_ref_wait
— wait for all USB device
references to complete
SYNOPSIS
#include
<dev/usb/usb.h>
#include <dev/usb/usbdi.h>
void
usbd_ref_incr
(struct
usbd_device *dev);
void
usbd_ref_decr
(struct
usbd_device *dev);
void
usbd_ref_wait
(struct
usbd_device *dev);
DESCRIPTION
The
usbd_ref_wait
()
function is used on a device level to tsleep(9) until the reference counter has reached zero.
To increase the reference counter use
usbd_ref_incr
().
To decrease the reference counter use
usbd_ref_decr
().
Once the reference counter has been decreased to zero,
usbd_ref_decr
() will call
wakeup
()
to interrupt the
tsleep
()
at the point where usbd_ref_wait
() was previously
set.
Typical use cases to wait for tasks to complete is at device closing or detachment.
CONTEXT
usbd_ref_incr
(),
usbd_ref_decr
(), and
usbd_ref_wait
() can be called during autoconf or
from process context.