diff options
Diffstat (limited to 'drivers/usb/core/driver.c')
-rw-r--r-- | drivers/usb/core/driver.c | 21 |
1 files changed, 19 insertions, 2 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 | */ |
1036 | int usb_suspend_both(struct usb_device *udev, pm_message_t msg) | 1036 | static 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 | */ |
1112 | int usb_resume_both(struct usb_device *udev) | 1112 | static 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 */ | ||
1177 | void 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 | } |
1406 | EXPORT_SYMBOL_GPL(usb_autopm_set_interface); | 1418 | EXPORT_SYMBOL_GPL(usb_autopm_set_interface); |
1407 | 1419 | ||
1420 | #else | ||
1421 | |||
1422 | void usb_autosuspend_work(struct work_struct *work) | ||
1423 | {} | ||
1424 | |||
1408 | #endif /* CONFIG_USB_SUSPEND */ | 1425 | #endif /* CONFIG_USB_SUSPEND */ |
1409 | 1426 | ||
1410 | static int usb_suspend(struct device *dev, pm_message_t message) | 1427 | static int usb_suspend(struct device *dev, pm_message_t message) |