summaryrefslogtreecommitdiff
path: root/drivers/usb/core/driver.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-05-04 11:51:54 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-12 16:29:46 -0700
commitb6f6436da0c6853eedad86f5075b139c1a3bcb5d (patch)
tree60082b119bcd08baa2a6f24daab6bb1c864f974e /drivers/usb/core/driver.c
parent4d461095ef6967324bc5da5d65d23ad27fc604f9 (diff)
USB: move bus_suspend and bus_resume method calls
This patch (as885) moves the root-hub bus_suspend() and bus_resume() method calls from the hub driver's suspend and resume methods into the usb_generic driver methods, where they make just as much sense. Their old locations were not fully correct. For example, in a kernel compiled without CONFIG_USB_SUSPEND, if one were to do: echo -n 1-0:1.0 >/sys/bus/usb/drivers/hub/unbind to unbind the hub driver from a root hub, there would then be no way to suspend that root hub. Attempts to put the system to sleep would fail; the USB controller driver would refuse to suspend because the root hub was still active. The patch also makes a very slight change in the way devices with no driver are handled during suspend. Rather than doing a standard USB port-suspend directly, now the suspend routine in usb_generic is called. In practice this should never affect anyone. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/driver.c')
-rw-r--r--drivers/usb/core/driver.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 63d47946e3db..e8b447e06c54 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -802,14 +802,13 @@ static int usb_suspend_device(struct usb_device *udev, pm_message_t msg)
udev->state == USB_STATE_SUSPENDED)
goto done;
- /* For devices that don't have a driver, we do a standard suspend. */
- if (udev->dev.driver == NULL) {
+ /* For devices that don't have a driver, we do a generic suspend. */
+ if (udev->dev.driver)
+ udriver = to_usb_device_driver(udev->dev.driver);
+ else {
udev->do_remote_wakeup = 0;
- status = usb_port_suspend(udev);
- goto done;
+ udriver = &usb_generic_driver;
}
-
- udriver = to_usb_device_driver(udev->dev.driver);
status = udriver->suspend(udev, msg);
done: