diff options
author | David Brownell <david-b@pacbell.net> | 2005-09-13 22:57:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 19:47:39 -0400 |
commit | dbc3887e7df4be78b33a83b97fde5d5f9a389859 (patch) | |
tree | d0b037dbf3971bbd95d038429857ef9f78a19879 | |
parent | 390a8c345e6415cbf811232feedac70b56c9fc8d (diff) |
[PATCH] remove duplicated resume path code
This gets rid of some inconsistently duplicated logic to resume interfaces.
Similar code was in both finish_port_resume() and in usb_generic_resume().
Now there is just one copy of that code, accessed regardless of whether
CONFIG_USB_SUSPEND is enabled. Fault handling is also more consistent.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/core/hub.c | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 33127b828d60..b2ae9b6ca4db 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1723,6 +1723,7 @@ static int finish_port_resume(struct usb_device *udev) | |||
1723 | status); | 1723 | status); |
1724 | else if (udev->actconfig) { | 1724 | else if (udev->actconfig) { |
1725 | unsigned i; | 1725 | unsigned i; |
1726 | int (*resume)(struct device *); | ||
1726 | 1727 | ||
1727 | le16_to_cpus(&devstatus); | 1728 | le16_to_cpus(&devstatus); |
1728 | if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) { | 1729 | if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) { |
@@ -1741,35 +1742,11 @@ static int finish_port_resume(struct usb_device *udev) | |||
1741 | } | 1742 | } |
1742 | 1743 | ||
1743 | /* resume interface drivers; if this is a hub, it | 1744 | /* resume interface drivers; if this is a hub, it |
1744 | * resumes the child devices | 1745 | * may have a child resume event to deal with soon |
1745 | */ | 1746 | */ |
1746 | for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { | 1747 | resume = udev->dev.bus->resume; |
1747 | struct usb_interface *intf; | 1748 | for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) |
1748 | struct usb_driver *driver; | 1749 | (void) resume(&udev->actconfig->interface[i]->dev); |
1749 | |||
1750 | intf = udev->actconfig->interface[i]; | ||
1751 | if (is_active(intf)) | ||
1752 | continue; | ||
1753 | if (!intf->dev.driver) { | ||
1754 | /* FIXME maybe force to alt 0 */ | ||
1755 | continue; | ||
1756 | } | ||
1757 | driver = to_usb_driver(intf->dev.driver); | ||
1758 | |||
1759 | /* bus_rescan_devices() may rebind drivers */ | ||
1760 | if (!driver->resume) | ||
1761 | continue; | ||
1762 | |||
1763 | /* can we do better than just logging errors? */ | ||
1764 | mark_active(intf); | ||
1765 | status = driver->resume(intf); | ||
1766 | if (status < 0) { | ||
1767 | mark_quiesced(intf); | ||
1768 | dev_dbg(&intf->dev, | ||
1769 | "resume error %d\n", | ||
1770 | status); | ||
1771 | } | ||
1772 | } | ||
1773 | status = 0; | 1750 | status = 0; |
1774 | 1751 | ||
1775 | } else if (udev->devnum <= 0) { | 1752 | } else if (udev->devnum <= 0) { |