aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/core/hub.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/hub.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/hub.c')
-rw-r--r--drivers/usb/core/hub.c32
1 files changed, 1 insertions, 31 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index a9cf8b30bcc..8aea8559bec 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1916,7 +1916,6 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
struct usb_hub *hub = usb_get_intfdata (intf);
struct usb_device *hdev = hub->hdev;
unsigned port1;
- int status = 0;
/* fail if children aren't already suspended */
for (port1 = 1; port1 <= hdev->maxchild; port1++) {
@@ -1942,44 +1941,15 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
/* stop khubd and related activity */
hub_quiesce(hub);
-
- /* "global suspend" of the downstream HC-to-USB interface */
- if (!hdev->parent) {
- status = hcd_bus_suspend(hdev->bus);
- if (status != 0) {
- dev_dbg(&hdev->dev, "'global' suspend %d\n", status);
- hub_activate(hub);
- }
- }
- return status;
+ return 0;
}
static int hub_resume(struct usb_interface *intf)
{
struct usb_hub *hub = usb_get_intfdata (intf);
- struct usb_device *hdev = hub->hdev;
- int status;
dev_dbg(&intf->dev, "%s\n", __FUNCTION__);
- /* "global resume" of the downstream HC-to-USB interface */
- if (!hdev->parent) {
- struct usb_bus *bus = hdev->bus;
- if (bus) {
- status = hcd_bus_resume (bus);
- if (status) {
- dev_dbg(&intf->dev, "'global' resume %d\n",
- status);
- return status;
- }
- } else
- return -EOPNOTSUPP;
- if (status == 0) {
- /* TRSMRCY = 10 msec */
- msleep(10);
- }
- }
-
/* tell khubd to look for changes on this hub */
hub_activate(hub);
return 0;