Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 195382
b: refs/heads/master
c: 7560d32
h: refs/heads/master
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed May 20, 2010
1 parent 9ff8daf commit 353ce0c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ff9c895f07d36193c75533bda8193bde8ca99d02
refs/heads/master: 7560d32ec70508a71f537a88e40f7717f15389ac
19 changes: 8 additions & 11 deletions trunk/drivers/usb/core/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1486,9 +1486,6 @@ int usb_autoresume_device(struct usb_device *udev)
* 0, a delayed autosuspend request for @intf's device is attempted. The
* attempt may fail (see autosuspend_check()).
*
* If the driver has set @intf->needs_remote_wakeup then autosuspend will
* take place only if the device's remote-wakeup facility is enabled.
*
* This routine can run only in process context.
*/
void usb_autopm_put_interface(struct usb_interface *intf)
Expand Down Expand Up @@ -1673,14 +1670,14 @@ EXPORT_SYMBOL_GPL(usb_autopm_get_interface_no_resume);
/* Internal routine to check whether we may autosuspend a device. */
static int autosuspend_check(struct usb_device *udev)
{
int i;
int w, i;
struct usb_interface *intf;
unsigned long suspend_time, j;

/* Fail if autosuspend is disabled, or any interfaces are in use, or
* any interface drivers require remote wakeup but it isn't available.
*/
udev->do_remote_wakeup = device_may_wakeup(&udev->dev);
w = 0;
if (udev->actconfig) {
for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
intf = udev->actconfig->interface[i];
Expand All @@ -1694,12 +1691,7 @@ static int autosuspend_check(struct usb_device *udev)
continue;
if (atomic_read(&intf->dev.power.usage_count) > 0)
return -EBUSY;
if (intf->needs_remote_wakeup &&
!udev->do_remote_wakeup) {
dev_dbg(&udev->dev, "remote wakeup needed "
"for autosuspend\n");
return -EOPNOTSUPP;
}
w |= intf->needs_remote_wakeup;

/* Don't allow autosuspend if the device will need
* a reset-resume and any of its interface drivers
Expand All @@ -1715,6 +1707,11 @@ static int autosuspend_check(struct usb_device *udev)
}
}
}
if (w && !device_can_wakeup(&udev->dev)) {
dev_dbg(&udev->dev, "remote wakeup needed for autosuspend\n");
return -EOPNOTSUPP;
}
udev->do_remote_wakeup = w;

/* If everything is okay but the device hasn't been idle for long
* enough, queue a delayed autosuspend request.
Expand Down

0 comments on commit 353ce0c

Please sign in to comment.