Am Freitag, 25. Mai 2007 04:20 schrieb Alan Stern: > On Thu, 24 May 2007, Greg KH wrote: > > > On Wed, May 23, 2007 at 06:25:36PM +0200, Oliver Neukum wrote: > > > 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. > > > > But what code is using it? I don't want to add an api call if no one > > uses it...
I can assure you that any input driver that has some output (HID, PID, etc) will use this. > In fact there's a potential user in hcd.c:usb_hcd_resume_root_hub(). > If there's to be an accessor, that routine should use it. Done. > Oliver, you should be careful about what happens when CONFIG_PM is off. > Under those conditions the workqueue is not created. Done 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-25 10:54:03.000000000 +0200 @@ -1648,6 +1648,24 @@ 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) +{ +#ifdef CONFIG_PM + queue_work(ksuspend_usb_wq, work); +#endif +} + +EXPORT_SYMBOL(usb_schedule_power_work); + // synchronous request completion model EXPORT_SYMBOL(usb_control_msg); EXPORT_SYMBOL(usb_bulk_msg); --- a/drivers/usb/core/hcd.c 2007-05-22 14:50:32.000000000 +0200 +++ b/drivers/usb/core/hcd.c 2007-05-25 10:53:56.000000000 +0200 @@ -1326,7 +1326,7 @@ void usb_hcd_resume_root_hub (struct usb spin_lock_irqsave (&hcd_root_hub_lock, flags); if (hcd->rh_registered) - queue_work(ksuspend_usb_wq, &hcd->wakeup_work); + usb_schedule_power_work(&hcd->wakeup_work); spin_unlock_irqrestore (&hcd_root_hub_lock, flags); } EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub); ------------------------------------------------------------------------- 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