aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2011-06-15 16:27:43 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-06-15 20:44:56 -0400
commit0af212ba8f123c2eba151af7726c34a50b127962 (patch)
treef9b37cad57b00c6e845954f361acedead9863d13
parentcbb330045e5df8f665ac60227ff898421fc8fb92 (diff)
USB: don't let errors prevent system sleep
This patch (as1464) implements the recommended policy that most errors during suspend or hibernation should not prevent the system from going to sleep. In particular, failure to suspend a USB driver or a USB device should not prevent the sleep from succeeding: Failure to suspend a device won't matter, because the device will automatically go into suspend mode when the USB bus stops carrying packets. (This might be less true for USB-3.0 devices, but let's not worry about them now.) Failure of a driver to suspend might lead to trouble later on when the system wakes up, but it isn't sufficient reason to prevent the system from going to sleep. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/core/driver.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index e35a17687c0..81add81ab04 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1187,13 +1187,22 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1187 for (i = n - 1; i >= 0; --i) { 1187 for (i = n - 1; i >= 0; --i) {
1188 intf = udev->actconfig->interface[i]; 1188 intf = udev->actconfig->interface[i];
1189 status = usb_suspend_interface(udev, intf, msg); 1189 status = usb_suspend_interface(udev, intf, msg);
1190
1191 /* Ignore errors during system sleep transitions */
1192 if (!(msg.event & PM_EVENT_AUTO))
1193 status = 0;
1190 if (status != 0) 1194 if (status != 0)
1191 break; 1195 break;
1192 } 1196 }
1193 } 1197 }
1194 if (status == 0) 1198 if (status == 0) {
1195 status = usb_suspend_device(udev, msg); 1199 status = usb_suspend_device(udev, msg);
1196 1200
1201 /* Again, ignore errors during system sleep transitions */
1202 if (!(msg.event & PM_EVENT_AUTO))
1203 status = 0;
1204 }
1205
1197 /* If the suspend failed, resume interfaces that did get suspended */ 1206 /* If the suspend failed, resume interfaces that did get suspended */
1198 if (status != 0) { 1207 if (status != 0) {
1199 msg.event ^= (PM_EVENT_SUSPEND | PM_EVENT_RESUME); 1208 msg.event ^= (PM_EVENT_SUSPEND | PM_EVENT_RESUME);