Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: don't let the hub driver prevent system sleep

This patch (as1465) continues implementation of the policy that errors
during suspend or hibernation should not prevent the system from going
to sleep.

In this case, failure to turn on the Suspend feature for a hub port
shouldn't be reported as an error. There are situations where this
does actually occur (such as when the device plugged into that port
was disconnected in the recent past), and it turns out to be harmless.
There's no reason for it to prevent a system sleep.

Also, don't allow the hub driver to fail a system suspend if the
downstream ports aren't all suspended. This is also harmless (and
should never happen, given the change mentioned above); printing a
warning message in the kernel log is all we really need to do.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Alan Stern and committed by
Greg Kroah-Hartman
cbb33004 578333ab

+8 -5
+8 -5
drivers/usb/core/hub.c
··· 2362 2362 USB_DEVICE_REMOTE_WAKEUP, 0, 2363 2363 NULL, 0, 2364 2364 USB_CTRL_SET_TIMEOUT); 2365 + 2366 + /* System sleep transitions should never fail */ 2367 + if (!(msg.event & PM_EVENT_AUTO)) 2368 + status = 0; 2365 2369 } else { 2366 2370 /* device has up to 10 msec to fully suspend */ 2367 2371 dev_dbg(&udev->dev, "usb %ssuspend\n", ··· 2615 2611 struct usb_device *hdev = hub->hdev; 2616 2612 unsigned port1; 2617 2613 2618 - /* fail if children aren't already suspended */ 2614 + /* Warn if children aren't already suspended */ 2619 2615 for (port1 = 1; port1 <= hdev->maxchild; port1++) { 2620 2616 struct usb_device *udev; 2621 2617 2622 2618 udev = hdev->children [port1-1]; 2623 2619 if (udev && udev->can_submit) { 2624 - if (!(msg.event & PM_EVENT_AUTO)) 2625 - dev_dbg(&intf->dev, "port %d nyet suspended\n", 2626 - port1); 2627 - return -EBUSY; 2620 + dev_warn(&intf->dev, "port %d nyet suspended\n", port1); 2621 + if (msg.event & PM_EVENT_AUTO) 2622 + return -EBUSY; 2628 2623 } 2629 2624 } 2630 2625