Commit 0534d468 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

USB: consolidate remote wakeup routines

This patch (as1324) makes a small change to the code used for remote
wakeup of root hubs.  hcd_resume_work() now calls the hub driver's
remote-wakeup routine instead of implementing its own version.

The patch is complicated by the need to rename remote_wakeup() to
usb_remote_wakeup(), make it non-static, and declare it in a header
file.  There's also the additional complication required to make
everything work when CONFIG_PM isn't set; the do-nothing inline
routine had to be moved into the header file.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 62e299e6
...@@ -1865,8 +1865,7 @@ static void hcd_resume_work(struct work_struct *work) ...@@ -1865,8 +1865,7 @@ static void hcd_resume_work(struct work_struct *work)
struct usb_device *udev = hcd->self.root_hub; struct usb_device *udev = hcd->self.root_hub;
usb_lock_device(udev); usb_lock_device(udev);
usb_mark_last_busy(udev); usb_remote_wakeup(udev);
usb_external_resume_device(udev, PMSG_REMOTE_RESUME);
usb_unlock_device(udev); usb_unlock_device(udev);
} }
......
...@@ -2399,7 +2399,7 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg) ...@@ -2399,7 +2399,7 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
} }
/* caller has locked udev */ /* caller has locked udev */
static int remote_wakeup(struct usb_device *udev) int usb_remote_wakeup(struct usb_device *udev)
{ {
int status = 0; int status = 0;
...@@ -2443,7 +2443,7 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg) ...@@ -2443,7 +2443,7 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
return status; return status;
} }
static inline int remote_wakeup(struct usb_device *udev) int usb_remote_wakeup(struct usb_device *udev)
{ {
return 0; return 0;
} }
...@@ -2514,11 +2514,6 @@ EXPORT_SYMBOL_GPL(usb_root_hub_lost_power); ...@@ -2514,11 +2514,6 @@ EXPORT_SYMBOL_GPL(usb_root_hub_lost_power);
#else /* CONFIG_PM */ #else /* CONFIG_PM */
static inline int remote_wakeup(struct usb_device *udev)
{
return 0;
}
#define hub_suspend NULL #define hub_suspend NULL
#define hub_resume NULL #define hub_resume NULL
#define hub_reset_resume NULL #define hub_reset_resume NULL
...@@ -3017,7 +3012,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, ...@@ -3017,7 +3012,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
/* For a suspended device, treat this as a /* For a suspended device, treat this as a
* remote wakeup event. * remote wakeup event.
*/ */
status = remote_wakeup(udev); status = usb_remote_wakeup(udev);
#endif #endif
} else { } else {
...@@ -3363,7 +3358,7 @@ static void hub_events(void) ...@@ -3363,7 +3358,7 @@ static void hub_events(void)
msleep(10); msleep(10);
usb_lock_device(udev); usb_lock_device(udev);
ret = remote_wakeup(hdev-> ret = usb_remote_wakeup(hdev->
children[i-1]); children[i-1]);
usb_unlock_device(udev); usb_unlock_device(udev);
if (ret < 0) if (ret < 0)
......
...@@ -63,6 +63,7 @@ extern int usb_external_suspend_device(struct usb_device *udev, ...@@ -63,6 +63,7 @@ extern int usb_external_suspend_device(struct usb_device *udev,
pm_message_t msg); pm_message_t msg);
extern int usb_external_resume_device(struct usb_device *udev, extern int usb_external_resume_device(struct usb_device *udev,
pm_message_t msg); pm_message_t msg);
extern int usb_remote_wakeup(struct usb_device *dev);
static inline void usb_pm_lock(struct usb_device *udev) static inline void usb_pm_lock(struct usb_device *udev)
{ {
...@@ -86,6 +87,11 @@ static inline int usb_port_resume(struct usb_device *udev, pm_message_t msg) ...@@ -86,6 +87,11 @@ static inline int usb_port_resume(struct usb_device *udev, pm_message_t msg)
return 0; return 0;
} }
static inline int usb_remote_wakeup(struct usb_device *udev)
{
return 0;
}
static inline void usb_pm_lock(struct usb_device *udev) {} static inline void usb_pm_lock(struct usb_device *udev) {}
static inline void usb_pm_unlock(struct usb_device *udev) {} static inline void usb_pm_unlock(struct usb_device *udev) {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment