From: Alan Stern Date: Thu, 20 Sep 2007 16:37:50 +0000 (-0400) Subject: USB: don't propagate FREEZE or PRETHAW suspends X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7108f28465a0a37d5afc05c5ad788938423b74a7;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git USB: don't propagate FREEZE or PRETHAW suspends 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index ba5bbc7eedcc..3f734240e0ec 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -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); }