diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2007-05-30 23:34:36 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-13 03:34:29 +0400 |
commit | 686314cfbdac21c9019c0e04487b5d940db62406 (patch) | |
tree | 245810b09a9b19dc74e668a244e1d5ad88ff6bee /drivers/usb/core/hub.c | |
parent | 4956eccdd6101c5abb71966079e8183d12796d6c (diff) | |
download | linux-686314cfbdac21c9019c0e04487b5d940db62406.tar.xz |
USB: separate root and non-root suspend/resume
This patch (as916) completes the separation of code paths for suspend
and resume of root hubs as opposed to non-root devices. Root hubs
will be power-managed through their bus_suspend and bus_resume
methods, whereas normal devices will use usb_port_suspend() and
usb_port_resume().
Changes to the hcd_bus_{suspend,resume} routines mostly represent
motion of code that was already present elsewhere. They include:
Adding debugging log messages,
Setting the device state appropriately, and
Adding a resume recovery time delay.
Changes to the port-suspend and port-resume routines in hub.c include:
Removal of checks for root devices (since they will never
be triggered), and
Removal of checks for NULL or invalid device pointers (these
were left over from earlier kernel versions and aren't needed
at all).
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.c | 42 |
1 files changed, 8 insertions, 34 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 04d6fde57d88..ac1ef1527dd2 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1722,17 +1722,8 @@ int usb_port_suspend(struct usb_device *udev) { int status = 0; - /* we change the device's upstream USB link, - * but root hubs have no upstream USB link. - */ - if (udev->parent) - status = hub_port_suspend(hdev_to_hub(udev->parent), - udev->portnum, udev); - else { - dev_dbg(&udev->dev, "usb %ssuspend\n", - udev->auto_pm ? "auto-" : ""); - usb_set_device_state(udev, USB_STATE_SUSPENDED); - } + status = hub_port_suspend(hdev_to_hub(udev->parent), + udev->portnum, udev); return status; } @@ -1775,8 +1766,7 @@ static int finish_port_resume(struct usb_device *udev) status); else if (udev->actconfig) { le16_to_cpus(&devstatus); - if ((devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) - && udev->parent) { + if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) { status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), USB_REQ_CLEAR_FEATURE, @@ -1789,10 +1779,6 @@ static int finish_port_resume(struct usb_device *udev) "wakeup, status %d\n", status); } status = 0; - - } else if (udev->devnum <= 0) { - dev_dbg(&udev->dev, "bogus resume!\n"); - status = -EINVAL; } return status; } @@ -1821,9 +1807,8 @@ hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev) port1, status); } else { /* drive resume for at least 20 msec */ - if (udev) - dev_dbg(&udev->dev, "usb %sresume\n", - udev->auto_pm ? "auto-" : ""); + dev_dbg(&udev->dev, "usb %sresume\n", + udev->auto_pm ? "auto-" : ""); msleep(25); #define LIVE_FLAGS ( USB_PORT_STAT_POWER \ @@ -1851,8 +1836,7 @@ SuspendCleared: USB_PORT_FEAT_C_SUSPEND); /* TRSMRCY = 10 msec */ msleep(10); - if (udev) - status = finish_port_resume(udev); + status = finish_port_resume(udev); } } if (status < 0) @@ -1882,18 +1866,8 @@ int usb_port_resume(struct usb_device *udev) { int status; - /* we change the device's upstream USB link, - * but root hubs have no upstream USB link. - */ - if (udev->parent) { - // NOTE this fails if parent is also suspended... - status = hub_port_resume(hdev_to_hub(udev->parent), - udev->portnum, udev); - } else { - dev_dbg(&udev->dev, "usb %sresume\n", - udev->auto_pm ? "auto-" : ""); - status = finish_port_resume(udev); - } + status = hub_port_resume(hdev_to_hub(udev->parent), + udev->portnum, udev); if (status < 0) dev_dbg(&udev->dev, "can't resume, status %d\n", status); return status; |