aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/core/usb.c')
-rw-r--r--drivers/usb/core/usb.c35
1 files changed, 3 insertions, 32 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 0daff0d968ba..32966ccdff63 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -49,9 +49,6 @@ const char *usbcore_name = "usbcore";
49 49
50static int nousb; /* Disable USB when built into kernel image */ 50static int nousb; /* Disable USB when built into kernel image */
51 51
52/* Workqueue for autosuspend and for remote wakeup of root hubs */
53struct workqueue_struct *ksuspend_usb_wq;
54
55#ifdef CONFIG_USB_SUSPEND 52#ifdef CONFIG_USB_SUSPEND
56static int usb_autosuspend_delay = 2; /* Default delay value, 53static int usb_autosuspend_delay = 2; /* Default delay value,
57 * in seconds */ 54 * in seconds */
@@ -264,23 +261,6 @@ static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
264 261
265#ifdef CONFIG_PM 262#ifdef CONFIG_PM
266 263
267static int ksuspend_usb_init(void)
268{
269 /* This workqueue is supposed to be both freezable and
270 * singlethreaded. Its job doesn't justify running on more
271 * than one CPU.
272 */
273 ksuspend_usb_wq = create_freezeable_workqueue("ksuspend_usbd");
274 if (!ksuspend_usb_wq)
275 return -ENOMEM;
276 return 0;
277}
278
279static void ksuspend_usb_cleanup(void)
280{
281 destroy_workqueue(ksuspend_usb_wq);
282}
283
284/* USB device Power-Management thunks. 264/* USB device Power-Management thunks.
285 * There's no need to distinguish here between quiescing a USB device 265 * There's no need to distinguish here between quiescing a USB device
286 * and powering it down; the generic_suspend() routine takes care of 266 * and powering it down; the generic_suspend() routine takes care of
@@ -296,7 +276,7 @@ static int usb_dev_prepare(struct device *dev)
296static void usb_dev_complete(struct device *dev) 276static void usb_dev_complete(struct device *dev)
297{ 277{
298 /* Currently used only for rebinding interfaces */ 278 /* Currently used only for rebinding interfaces */
299 usb_resume(dev, PMSG_RESUME); /* Message event is meaningless */ 279 usb_resume(dev, PMSG_ON); /* FIXME: change to PMSG_COMPLETE */
300} 280}
301 281
302static int usb_dev_suspend(struct device *dev) 282static int usb_dev_suspend(struct device *dev)
@@ -342,9 +322,7 @@ static const struct dev_pm_ops usb_device_pm_ops = {
342 322
343#else 323#else
344 324
345#define ksuspend_usb_init() 0 325#define usb_device_pm_ops (*(struct dev_pm_ops *) NULL)
346#define ksuspend_usb_cleanup() do {} while (0)
347#define usb_device_pm_ops (*(struct dev_pm_ops *)0)
348 326
349#endif /* CONFIG_PM */ 327#endif /* CONFIG_PM */
350 328
@@ -472,9 +450,6 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,
472 INIT_LIST_HEAD(&dev->filelist); 450 INIT_LIST_HEAD(&dev->filelist);
473 451
474#ifdef CONFIG_PM 452#ifdef CONFIG_PM
475 mutex_init(&dev->pm_mutex);
476 INIT_DELAYED_WORK(&dev->autosuspend, usb_autosuspend_work);
477 INIT_WORK(&dev->autoresume, usb_autoresume_work);
478 dev->autosuspend_delay = usb_autosuspend_delay * HZ; 453 dev->autosuspend_delay = usb_autosuspend_delay * HZ;
479 dev->connect_time = jiffies; 454 dev->connect_time = jiffies;
480 dev->active_duration = -jiffies; 455 dev->active_duration = -jiffies;
@@ -1117,9 +1092,6 @@ static int __init usb_init(void)
1117 if (retval) 1092 if (retval)
1118 goto out; 1093 goto out;
1119 1094
1120 retval = ksuspend_usb_init();
1121 if (retval)
1122 goto out;
1123 retval = bus_register(&usb_bus_type); 1095 retval = bus_register(&usb_bus_type);
1124 if (retval) 1096 if (retval)
1125 goto bus_register_failed; 1097 goto bus_register_failed;
@@ -1159,7 +1131,7 @@ major_init_failed:
1159bus_notifier_failed: 1131bus_notifier_failed:
1160 bus_unregister(&usb_bus_type); 1132 bus_unregister(&usb_bus_type);
1161bus_register_failed: 1133bus_register_failed:
1162 ksuspend_usb_cleanup(); 1134 usb_debugfs_cleanup();
1163out: 1135out:
1164 return retval; 1136 return retval;
1165} 1137}
@@ -1181,7 +1153,6 @@ static void __exit usb_exit(void)
1181 usb_hub_cleanup(); 1153 usb_hub_cleanup();
1182 bus_unregister_notifier(&usb_bus_type, &usb_bus_nb); 1154 bus_unregister_notifier(&usb_bus_type, &usb_bus_nb);
1183 bus_unregister(&usb_bus_type); 1155 bus_unregister(&usb_bus_type);
1184 ksuspend_usb_cleanup();
1185 usb_debugfs_cleanup(); 1156 usb_debugfs_cleanup();
1186} 1157}
1187 1158