summaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/driver.c
diff options
context:
space:
mode:
authorAlan Stern2006-09-19 16:14:07 +0200
committerGreg Kroah-Hartman2006-09-29 00:36:44 +0200
commitbd859281c09b4318153dc7222b5e9052aad83b61 (patch)
treec56c116b7720aae3dc5192f115444d16a5c21e58 /drivers/usb/core/driver.c
parentUSB Storage: unusual_devs.h entry for Sony Ericsson P990i (diff)
downloadkernel-qcow2-linux-bd859281c09b4318153dc7222b5e9052aad83b61.tar.gz
kernel-qcow2-linux-bd859281c09b4318153dc7222b5e9052aad83b61.tar.xz
kernel-qcow2-linux-bd859281c09b4318153dc7222b5e9052aad83b61.zip
USB: create new workqueue thread for USB autosuspend
This patch (as787) creates a new workqueue thread to handle delayed USB autosuspend requests. Previously the code used keventd. However it turns out that the hub driver's suspend routine calls flush_scheduled_work(), making it a poor candidate for running in keventd (the call immediately deadlocks). The solution is to use a new thread instead of keventd. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/driver.c')
-rw-r--r--drivers/usb/core/driver.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index c2aad6a4d49f..ee18d187ca17 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -24,6 +24,7 @@
#include <linux/device.h>
#include <linux/usb.h>
+#include <linux/workqueue.h>
#include "hcd.h"
#include "usb.h"
@@ -1131,7 +1132,7 @@ void usb_autosuspend_device(struct usb_device *udev, int dec_usage_cnt)
mutex_lock_nested(&udev->pm_mutex, udev->level);
udev->pm_usage_cnt -= dec_usage_cnt;
if (udev->pm_usage_cnt <= 0)
- schedule_delayed_work(&udev->autosuspend,
+ queue_delayed_work(ksuspend_usb_wq, &udev->autosuspend,
USB_AUTOSUSPEND_DELAY);
mutex_unlock(&udev->pm_mutex);
// dev_dbg(&udev->dev, "%s: cnt %d\n",
@@ -1215,10 +1216,10 @@ void usb_autopm_put_interface(struct usb_interface *intf)
struct usb_device *udev = interface_to_usbdev(intf);
mutex_lock_nested(&udev->pm_mutex, udev->level);
- if (intf->condition != USB_INTERFACE_UNBOUND) {
- if (--intf->pm_usage_cnt <= 0)
- schedule_delayed_work(&udev->autosuspend,
- USB_AUTOSUSPEND_DELAY);
+ if (intf->condition != USB_INTERFACE_UNBOUND &&
+ --intf->pm_usage_cnt <= 0) {
+ queue_delayed_work(ksuspend_usb_wq, &udev->autosuspend,
+ USB_AUTOSUSPEND_DELAY);
}
mutex_unlock(&udev->pm_mutex);
// dev_dbg(&intf->dev, "%s: cnt %d\n",