Am Mittwoch, 23. Mai 2007 17:42 schrieb Alan Stern: > On Wed, 23 May 2007, Oliver Neukum wrote: > > > That gives me an idea. > > Resumption of a device has to be done in task context. So if I allocate > > a private freezable work queue for HID resumption, the freezer would > > guard against illicit resumptions, wouldn't it? > > You can use the ksuspend_usb_wq workqueue. It already exists, is > freezable, and is used for suspending and resuming USB devices.
This adds a clean accessor for the USB core pm workqueue. Regards Oliver Signed-off-by: Oliver Neukum <[EMAIL PROTECTED]> -- --- a/include/linux/usb.h 2007-05-23 10:20:35.000000000 +0200 +++ b/include/linux/usb.h 2007-05-23 18:08:31.000000000 +0200 @@ -1343,6 +1343,8 @@ extern int usb_set_interface(struct usb_ /* this request isn't really synchronous, but it belongs with the others */ extern int usb_driver_set_configuration(struct usb_device *udev, int config); +extern void usb_schedule_power_work(struct work_struct *work); + /* * timeouts, in milliseconds, used for sending/receiving control messages * they typically complete within a few frames (msec) after they're issued --- a/drivers/usb/core/message.c 2007-05-22 14:50:32.000000000 +0200 +++ b/drivers/usb/core/message.c 2007-05-23 18:12:25.000000000 +0200 @@ -1648,6 +1648,22 @@ int usb_driver_set_configuration(struct } EXPORT_SYMBOL_GPL(usb_driver_set_configuration); +/** + * usb_schedule_power_work - allow drivers to execute work in the context of the pm thread + * @work: work to be executed + * + * This allows work to be scheduled which is to be executed under the + * same conditions pm's internal works are performed, namely to be + * frozen when they are frozen + */ + +void usb_schedule_power_work(struct work_struct *work) +{ + queue_work(ksuspend_usb_wq, work); +} + +EXPORT_SYMBOL(usb_schedule_power_work); + // synchronous request completion model EXPORT_SYMBOL(usb_control_msg); EXPORT_SYMBOL(usb_bulk_msg); ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel