diff options
Diffstat (limited to 'drivers/usb/core/driver.c')
-rw-r--r-- | drivers/usb/core/driver.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index e35a17687c05..34e3da5aa72a 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -375,7 +375,7 @@ static int usb_unbind_interface(struct device *dev) | |||
375 | * Just re-enable it without affecting the endpoint toggles. | 375 | * Just re-enable it without affecting the endpoint toggles. |
376 | */ | 376 | */ |
377 | usb_enable_interface(udev, intf, false); | 377 | usb_enable_interface(udev, intf, false); |
378 | } else if (!error && !intf->dev.power.in_suspend) { | 378 | } else if (!error && !intf->dev.power.is_prepared) { |
379 | r = usb_set_interface(udev, intf->altsetting[0]. | 379 | r = usb_set_interface(udev, intf->altsetting[0]. |
380 | desc.bInterfaceNumber, 0); | 380 | desc.bInterfaceNumber, 0); |
381 | if (r < 0) | 381 | if (r < 0) |
@@ -960,7 +960,7 @@ void usb_rebind_intf(struct usb_interface *intf) | |||
960 | } | 960 | } |
961 | 961 | ||
962 | /* Try to rebind the interface */ | 962 | /* Try to rebind the interface */ |
963 | if (!intf->dev.power.in_suspend) { | 963 | if (!intf->dev.power.is_prepared) { |
964 | intf->needs_binding = 0; | 964 | intf->needs_binding = 0; |
965 | rc = device_attach(&intf->dev); | 965 | rc = device_attach(&intf->dev); |
966 | if (rc < 0) | 966 | if (rc < 0) |
@@ -1107,7 +1107,7 @@ static int usb_resume_interface(struct usb_device *udev, | |||
1107 | if (intf->condition == USB_INTERFACE_UNBOUND) { | 1107 | if (intf->condition == USB_INTERFACE_UNBOUND) { |
1108 | 1108 | ||
1109 | /* Carry out a deferred switch to altsetting 0 */ | 1109 | /* Carry out a deferred switch to altsetting 0 */ |
1110 | if (intf->needs_altsetting0 && !intf->dev.power.in_suspend) { | 1110 | if (intf->needs_altsetting0 && !intf->dev.power.is_prepared) { |
1111 | usb_set_interface(udev, intf->altsetting[0]. | 1111 | usb_set_interface(udev, intf->altsetting[0]. |
1112 | desc.bInterfaceNumber, 0); | 1112 | desc.bInterfaceNumber, 0); |
1113 | intf->needs_altsetting0 = 0; | 1113 | intf->needs_altsetting0 = 0; |
@@ -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); |