[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 <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
commit dbc3887e7df4be78b33a83b97fde5d5f9a389859
tree d0b037dbf3971bbd95d038429857ef9f78a19879
parent 390a8c345e6415cbf811232feedac70b56c9fc8d
author David Brownell <[EMAIL PROTECTED]> Tue, 13 Sep 2005 19:57:36 -0700
committer Greg Kroah-Hartman <[EMAIL PROTECTED]> Fri, 28 Oct 2005 16:47:39 -0700

 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 33127b8..b2ae9b6 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1723,6 +1723,7 @@ static int finish_port_resume(struct usb
                        status);
        else if (udev->actconfig) {
                unsigned        i;
+               int             (*resume)(struct device *);
 
                le16_to_cpus(&devstatus);
                if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) {
@@ -1741,35 +1742,11 @@ static int finish_port_resume(struct usb
                }
 
                /* 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++) {
-                       struct usb_interface    *intf;
-                       struct usb_driver       *driver;
-
-                       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);
-                       }
-               }
+               resume = udev->dev.bus->resume;
+               for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++)
+                       (void) resume(&udev->actconfig->interface[i]->dev);
                status = 0;
 
        } else if (udev->devnum <= 0) {



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to