Commit 0c487206 authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

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: default avatarOliver Neukum <oliver@neukum.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 54ab2b02
...@@ -2123,9 +2123,13 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) ...@@ -2123,9 +2123,13 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
USB_DEVICE_REMOTE_WAKEUP, 0, USB_DEVICE_REMOTE_WAKEUP, 0,
NULL, 0, NULL, 0,
USB_CTRL_SET_TIMEOUT); USB_CTRL_SET_TIMEOUT);
if (status) if (status) {
dev_dbg(&udev->dev, "won't remote wakeup, status %d\n", dev_dbg(&udev->dev, "won't remote wakeup, status %d\n",
status); status);
/* bail if autosuspend is requested */
if (msg.event & PM_EVENT_AUTO)
return status;
}
} }
/* see 7.1.7.6 */ /* see 7.1.7.6 */
...@@ -2134,7 +2138,8 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) ...@@ -2134,7 +2138,8 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n", dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n",
port1, status); port1, status);
/* paranoia: "should not happen" */ /* paranoia: "should not happen" */
(void) usb_control_msg(udev, usb_sndctrlpipe(udev, 0), if (udev->do_remote_wakeup)
(void) usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
USB_REQ_CLEAR_FEATURE, USB_RECIP_DEVICE, USB_REQ_CLEAR_FEATURE, USB_RECIP_DEVICE,
USB_DEVICE_REMOTE_WAKEUP, 0, USB_DEVICE_REMOTE_WAKEUP, 0,
NULL, 0, NULL, 0,
......
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