提交 cd4376e2 编写于 作者: A Alan Stern 提交者: Greg Kroah-Hartman

USB: don't ignore suspend errors for root hubs

This patch (as1532) fixes a mistake in the USB suspend code.  When the
system is going to sleep, we should ignore errors in powering down USB
devices, because they don't really matter.  The devices will go to low
power anyway when the entire USB bus gets suspended (except for
SuperSpeed devices; maybe they will need special treatment later).

However we should not ignore errors in suspending root hubs,
especially if the error indicates that the suspend raced with a wakeup
request.  Doing so might leave the bus powered on while the system was
supposed to be asleep, or it might cause the suspend of the root hub's
parent controller device to fail, or it might cause a wakeup request
to be ignored.

The patch fixes the problem by ignoring errors only when the device in
question is not a root hub.
Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
Reported-by: NChen Peter <B29397@freescale.com>
CC: <stable@vger.kernel.org>
Tested-by: NChen Peter <peter.chen@freescale.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 891a3b1f
......@@ -1189,8 +1189,13 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
if (status == 0) {
status = usb_suspend_device(udev, msg);
/* Again, ignore errors during system sleep transitions */
if (!PMSG_IS_AUTO(msg))
/*
* Ignore errors from non-root-hub devices during
* system sleep transitions. For the most part,
* these devices should go to low power anyway when
* the entire bus is suspended.
*/
if (udev->parent && !PMSG_IS_AUTO(msg))
status = 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册