diff options
author | Oliver Neukum <oliver@neukum.org> | 2009-10-19 07:19:41 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-11 14:55:17 -0500 |
commit | 0c487206fe925ef370e1fc092003efb74ad57410 (patch) | |
tree | d01c998a7f54fed5d3cfb8ab4cdb1e9284cd1583 /drivers/usb | |
parent | 54ab2b02ef6a454b4cca969f546d0dd43fec7308 (diff) |
USB: improved error handling in usb_port_suspend()
usb: better error handling in usb_port_suspend
- disable remote wakeup only if it was enabled
- refuse to autosuspend if remote wakeup fails to be enabled
Signed-off-by: Oliver Neukum <oliver@neukum.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/hub.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 0f857e645058..2ac115015229 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -2123,9 +2123,13 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) | |||
2123 | USB_DEVICE_REMOTE_WAKEUP, 0, | 2123 | USB_DEVICE_REMOTE_WAKEUP, 0, |
2124 | NULL, 0, | 2124 | NULL, 0, |
2125 | USB_CTRL_SET_TIMEOUT); | 2125 | USB_CTRL_SET_TIMEOUT); |
2126 | if (status) | 2126 | if (status) { |
2127 | dev_dbg(&udev->dev, "won't remote wakeup, status %d\n", | 2127 | dev_dbg(&udev->dev, "won't remote wakeup, status %d\n", |
2128 | status); | 2128 | status); |
2129 | /* bail if autosuspend is requested */ | ||
2130 | if (msg.event & PM_EVENT_AUTO) | ||
2131 | return status; | ||
2132 | } | ||
2129 | } | 2133 | } |
2130 | 2134 | ||
2131 | /* see 7.1.7.6 */ | 2135 | /* see 7.1.7.6 */ |
@@ -2134,7 +2138,8 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) | |||
2134 | dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n", | 2138 | dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n", |
2135 | port1, status); | 2139 | port1, status); |
2136 | /* paranoia: "should not happen" */ | 2140 | /* paranoia: "should not happen" */ |
2137 | (void) usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 2141 | if (udev->do_remote_wakeup) |
2142 | (void) usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | ||
2138 | USB_REQ_CLEAR_FEATURE, USB_RECIP_DEVICE, | 2143 | USB_REQ_CLEAR_FEATURE, USB_RECIP_DEVICE, |
2139 | USB_DEVICE_REMOTE_WAKEUP, 0, | 2144 | USB_DEVICE_REMOTE_WAKEUP, 0, |
2140 | NULL, 0, | 2145 | NULL, 0, |