aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-03-09 15:41:13 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2007-04-27 16:28:34 -0400
commit718efa64e30a5e9db0351d70c5a91969306a12d1 (patch)
tree1b6b5a070c177bd0347df0542f3909cffab5cda9 /drivers
parent64e35d92367d8cd376946eb924838de1dd3287c7 (diff)
usbcore: move usb_autosuspend_work
This patch (as864) moves the work routine for USB autosuspend from one source file to another. This permits the removal of one whole global symbol (!) and should smooth the way for more changes in the future. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/core/driver.c21
-rw-r--r--drivers/usb/core/usb.c21
-rw-r--r--drivers/usb/core/usb.h8
3 files changed, 20 insertions, 30 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index e6dd2b9210f6..8c0a7de61228 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1033,7 +1033,7 @@ static int autosuspend_check(struct usb_device *udev)
1033 * 1033 *
1034 * This routine can run only in process context. 1034 * This routine can run only in process context.
1035 */ 1035 */
1036int usb_suspend_both(struct usb_device *udev, pm_message_t msg) 1036static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1037{ 1037{
1038 int status = 0; 1038 int status = 0;
1039 int i = 0; 1039 int i = 0;
@@ -1109,7 +1109,7 @@ int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1109 * 1109 *
1110 * This routine can run only in process context. 1110 * This routine can run only in process context.
1111 */ 1111 */
1112int usb_resume_both(struct usb_device *udev) 1112static int usb_resume_both(struct usb_device *udev)
1113{ 1113{
1114 int status = 0; 1114 int status = 0;
1115 int i; 1115 int i;
@@ -1173,6 +1173,18 @@ int usb_resume_both(struct usb_device *udev)
1173 1173
1174#ifdef CONFIG_USB_SUSPEND 1174#ifdef CONFIG_USB_SUSPEND
1175 1175
1176/* usb_autosuspend_work - callback routine to autosuspend a USB device */
1177void usb_autosuspend_work(struct work_struct *work)
1178{
1179 struct usb_device *udev =
1180 container_of(work, struct usb_device, autosuspend.work);
1181
1182 usb_pm_lock(udev);
1183 udev->auto_pm = 1;
1184 usb_suspend_both(udev, PMSG_SUSPEND);
1185 usb_pm_unlock(udev);
1186}
1187
1176/* Internal routine to adjust a device's usage counter and change 1188/* Internal routine to adjust a device's usage counter and change
1177 * its autosuspend state. 1189 * its autosuspend state.
1178 */ 1190 */
@@ -1405,6 +1417,11 @@ int usb_autopm_set_interface(struct usb_interface *intf)
1405} 1417}
1406EXPORT_SYMBOL_GPL(usb_autopm_set_interface); 1418EXPORT_SYMBOL_GPL(usb_autopm_set_interface);
1407 1419
1420#else
1421
1422void usb_autosuspend_work(struct work_struct *work)
1423{}
1424
1408#endif /* CONFIG_USB_SUSPEND */ 1425#endif /* CONFIG_USB_SUSPEND */
1409 1426
1410static int usb_suspend(struct device *dev, pm_message_t message) 1427static int usb_suspend(struct device *dev, pm_message_t message)
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 54b42ce311c1..82338f497860 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -211,27 +211,6 @@ static void ksuspend_usb_cleanup(void)
211 destroy_workqueue(ksuspend_usb_wq); 211 destroy_workqueue(ksuspend_usb_wq);
212} 212}
213 213
214#ifdef CONFIG_USB_SUSPEND
215
216/* usb_autosuspend_work - callback routine to autosuspend a USB device */
217static void usb_autosuspend_work(struct work_struct *work)
218{
219 struct usb_device *udev =
220 container_of(work, struct usb_device, autosuspend.work);
221
222 usb_pm_lock(udev);
223 udev->auto_pm = 1;
224 usb_suspend_both(udev, PMSG_SUSPEND);
225 usb_pm_unlock(udev);
226}
227
228#else
229
230static void usb_autosuspend_work(struct work_struct *work)
231{}
232
233#endif /* CONFIG_USB_SUSPEND */
234
235#else 214#else
236 215
237#define ksuspend_usb_init() 0 216#define ksuspend_usb_init() 0
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 08b5a04e3755..b98bc0d381c0 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -34,8 +34,7 @@ extern void usb_host_cleanup(void);
34 34
35#ifdef CONFIG_PM 35#ifdef CONFIG_PM
36 36
37extern int usb_suspend_both(struct usb_device *udev, pm_message_t msg); 37extern void usb_autosuspend_work(struct work_struct *work);
38extern int usb_resume_both(struct usb_device *udev);
39extern int usb_port_suspend(struct usb_device *dev); 38extern int usb_port_suspend(struct usb_device *dev);
40extern int usb_port_resume(struct usb_device *dev); 39extern int usb_port_resume(struct usb_device *dev);
41 40
@@ -51,11 +50,6 @@ static inline void usb_pm_unlock(struct usb_device *udev)
51 50
52#else 51#else
53 52
54#define usb_suspend_both(udev, msg) 0
55static inline int usb_resume_both(struct usb_device *udev)
56{
57 return 0;
58}
59#define usb_port_suspend(dev) 0 53#define usb_port_suspend(dev) 0
60#define usb_port_resume(dev) 0 54#define usb_port_resume(dev) 0
61static inline void usb_pm_lock(struct usb_device *udev) {} 55static inline void usb_pm_lock(struct usb_device *udev) {}