USB: don't propagate FREEZE or PRETHAW suspends
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 20 Sep 2007 16:37:50 +0000 (12:37 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 12 Oct 2007 21:55:28 +0000 (14:55 -0700)
This patch (as992) fixes a recently-added bug.  During a FREEZE or
PRETHAW suspend notification, non-root devices don't actually get
suspended.  So we shouldn't tell their parent hubs that they did.

(This code path used to be skipped over, until the FREEZE/PRETHAW test
got moved out of usb_suspend_both() into generic_suspend().)

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/driver.c

index ba5bbc7eedcc89dff274d800e3b0315380cf8afa..3f734240e0ec00ff81ea1587dd2d96b1dcef9ce0 100644 (file)
@@ -1112,7 +1112,12 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
                        usb_hcd_flush_endpoint(udev, udev->ep_out[i]);
                        usb_hcd_flush_endpoint(udev, udev->ep_in[i]);
                }
-               if (parent)
+
+               /* If this is just a FREEZE or a PRETHAW, udev might
+                * not really be suspended.  Only true suspends get
+                * propagated up the device tree.
+                */
+               if (parent && udev->state == USB_STATE_SUSPENDED)
                        usb_autosuspend_device(parent);
        }