Re: [PATCH V3] input: Fix USB autosuspend on bcm5974
From: Alan Stern <stern@rowland.harvard.edu>
Date: 2011-10-12 17:41:31
On Wed, 12 Oct 2011, Matthew Garrett wrote:
On Wed, Oct 12, 2011 at 01:24:42PM -0400, Alan Stern wrote:quoted
On Wed, 12 Oct 2011, Matthew Garrett wrote:quoted
True. That makes things rather more awkward.What about the second idea I mentioned? If autosuspend fails with -EBUSY or -EAGAIN, usbcore could schedule another autosuspend attempt.Yeah, that sounds better.
Does this patch help? Alan Stern drivers/usb/core/driver.c | 7 +++++++ 1 file changed, 7 insertions(+) Index: usb-3.1/drivers/usb/core/driver.c ===================================================================
--- usb-3.1.orig/drivers/usb/core/driver.c
+++ usb-3.1/drivers/usb/core/driver.c@@ -1667,6 +1667,13 @@ int usb_runtime_suspend(struct device *d return -EAGAIN; status = usb_suspend_both(udev, PMSG_AUTO_SUSPEND); + + /* Retry if autosuspend failed temporarily */ + if (status == -EBUSY || status == -EAGAIN) { + usb_mark_last_busy(udev); + pm_request_autosuspend(dev); + } + /* The PM core reacts badly unless the return code is 0, * -EAGAIN, or -EBUSY, so always return -EBUSY on an error. */