Add convenience wrapper functions to run callbacks in the context of the

USB explore thread.
This commit is contained in:
Hans Petter Selasky 2013-04-23 10:42:15 +00:00
parent 0cc59c05a3
commit 751aaf5a93
2 changed files with 31 additions and 0 deletions

View File

@ -901,3 +901,28 @@ usb_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb)
mtx_destroy(&bus->bus_mtx);
}
/* convenience wrappers */
void
usb_proc_explore_mwait(struct usb_device *udev, void *pm1, void *pm2)
{
usb_proc_mwait(USB_BUS_EXPLORE_PROC(udev->bus), pm1, pm2);
}
void *
usb_proc_explore_msignal(struct usb_device *udev, void *pm1, void *pm2)
{
return (usb_proc_msignal(USB_BUS_EXPLORE_PROC(udev->bus), pm1, pm2));
}
void
usb_proc_explore_lock(struct usb_device *udev)
{
USB_BUS_LOCK(udev->bus);
}
void
usb_proc_explore_unlock(struct usb_device *udev)
{
USB_BUS_UNLOCK(udev->bus);
}

View File

@ -44,6 +44,7 @@
/* structure prototypes */
struct usb_proc_msg;
struct usb_device;
/*
* The following structure defines the USB process.
@ -81,4 +82,9 @@ void usb_proc_free(struct usb_process *up);
void *usb_proc_msignal(struct usb_process *up, void *pm0, void *pm1);
void usb_proc_rewakeup(struct usb_process *up);
void usb_proc_explore_mwait(struct usb_device *, void *, void *);
void *usb_proc_explore_msignal(struct usb_device *, void *, void *);
void usb_proc_explore_lock(struct usb_device *);
void usb_proc_explore_unlock(struct usb_device *);
#endif /* _USB_PROCESS_H_ */