This patch (as884) finally implements the time-saving semantics
possible with the Power Management FREEZE and PRETHAW events.  Their
proper handling requires only that devices be quiesced, with
interrupts and DMA turned off; non-root USB devices don't actually
need to be put in a suspended state.  The patch checks and avoids
doing the suspend call when possible.

Signed-off-by: Alan Stern <[EMAIL PROTECTED]>

---

Index: usb-2.6/drivers/usb/core/generic.c
===================================================================
--- usb-2.6.orig/drivers/usb/core/generic.c
+++ usb-2.6/drivers/usb/core/generic.c
@@ -193,10 +193,6 @@ static void generic_disconnect(struct us
 
 static int generic_suspend(struct usb_device *udev, pm_message_t msg)
 {
-       /* USB devices enter SUSPEND state through their hubs, but can be
-        * marked for FREEZE as soon as their children are already idled.
-        * But those semantics are useless, so we equate the two (sigh).
-        */
        return usb_port_suspend(udev);
 }
 
Index: usb-2.6/drivers/usb/core/driver.c
===================================================================
--- usb-2.6.orig/drivers/usb/core/driver.c
+++ usb-2.6/drivers/usb/core/driver.c
@@ -1043,8 +1043,15 @@ static int usb_suspend_both(struct usb_d
                                break;
                }
        }
-       if (status == 0)
+       if (status == 0) {
+
+               /* Non-root devices don't need to do anything for FREEZE
+                * or PRETHAW. */
+               if (udev->parent && (msg.event == PM_EVENT_FREEZE ||
+                               msg.event == PM_EVENT_PRETHAW))
+                       goto done;
                status = usb_suspend_device(udev, msg);
+       }
 
        /* If the suspend failed, resume interfaces that did get suspended */
        if (status != 0) {


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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