Commit dbc3887e authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 390a8c34
...@@ -1723,6 +1723,7 @@ static int finish_port_resume(struct usb_device *udev) ...@@ -1723,6 +1723,7 @@ static int finish_port_resume(struct usb_device *udev)
status); status);
else if (udev->actconfig) { else if (udev->actconfig) {
unsigned i; unsigned i;
int (*resume)(struct device *);
le16_to_cpus(&devstatus); le16_to_cpus(&devstatus);
if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) { if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) {
...@@ -1741,35 +1742,11 @@ static int finish_port_resume(struct usb_device *udev) ...@@ -1741,35 +1742,11 @@ static int finish_port_resume(struct usb_device *udev)
} }
/* resume interface drivers; if this is a hub, it /* resume interface drivers; if this is a hub, it
* resumes the child devices * may have a child resume event to deal with soon
*/ */
for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { resume = udev->dev.bus->resume;
struct usb_interface *intf; for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++)
struct usb_driver *driver; (void) resume(&udev->actconfig->interface[i]->dev);
intf = udev->actconfig->interface[i];
if (is_active(intf))
continue;
if (!intf->dev.driver) {
/* FIXME maybe force to alt 0 */
continue;
}
driver = to_usb_driver(intf->dev.driver);
/* bus_rescan_devices() may rebind drivers */
if (!driver->resume)
continue;
/* can we do better than just logging errors? */
mark_active(intf);
status = driver->resume(intf);
if (status < 0) {
mark_quiesced(intf);
dev_dbg(&intf->dev,
"resume error %d\n",
status);
}
}
status = 0; status = 0;
} else if (udev->devnum <= 0) { } else if (udev->devnum <= 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment