Skip to content

Commit

Permalink
USB: move decision to ignore FREEZE events
Browse files Browse the repository at this point in the history
This patch (as987) changes the way FREEZE and PRETHAW suspend events
are handled in usbcore.  The decision about whether or not to ignore
them for non-root devices is pushed down into the USB-device driver,
instead of being made in the core code.

This is appropriate, since devices exported to a virtualized guest or
over a network may indeed need to handle these types of suspend, even
though normal devices don't.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Oct 12, 2007
1 parent 7477120 commit 5ad4f71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
9 changes: 1 addition & 8 deletions drivers/usb/core/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1088,15 +1088,8 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
break;
}
}
if (status == 0) {

/* Non-root devices don't need to do anything for FREEZE
* or PRETHAW. */
if (udev->parent && (msg.event == PM_EVENT_FREEZE ||
msg.event == PM_EVENT_PRETHAW))
goto done;
if (status == 0)
status = usb_suspend_device(udev, msg);
}

/* If the suspend failed, resume interfaces that did get suspended */
if (status != 0) {
Expand Down
5 changes: 5 additions & 0 deletions drivers/usb/core/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,13 @@ static int generic_suspend(struct usb_device *udev, pm_message_t msg)
*/
if (!udev->parent)
rc = hcd_bus_suspend(udev);

/* Non-root devices don't need to do anything for FREEZE or PRETHAW */
else if (msg.event == PM_EVENT_FREEZE || msg.event == PM_EVENT_PRETHAW)
rc = 0;
else
rc = usb_port_suspend(udev);

return rc;
}

Expand Down

0 comments on commit 5ad4f71

Please sign in to comment.