PM / Runtime: Automatically retry failed autosuspends
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 3 Nov 2011 22:39:18 +0000 (23:39 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Nov 2011 17:44:11 +0000 (09:44 -0800)
commitda5c50811e8e2342fd83c3d9fbd6609175fa2cf5
tree0643db59165ea8b71d67a3fb18bedf1ce4a36157
parentf571b637c81f3cbac21c93c2f0e283965235b152
PM / Runtime: Automatically retry failed autosuspends

commit 886486b792e4f6f96d4fbe8ec5bf20811cab7d6a upstream.

Originally, the runtime PM core would send an idle notification
whenever a suspend attempt failed.  The idle callback routine could
then schedule a delayed suspend for some time later.

However this behavior was changed by commit
f71648d73c1650b8b4aceb3856bebbde6daa3b86 (PM / Runtime: Remove idle
notification after failing suspend).  No notifications were sent, and
there was no clear mechanism to retry failed suspends.

This caused problems for the usbhid driver, because it fails
autosuspend attempts as long as a key is being held down.  Therefore
this patch (as1492) adds a mechanism for retrying failed
autosuspends.  If the callback routine updates the last_busy field so
that the next autosuspend expiration time is in the future, the
autosuspend will automatically be rescheduled.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Documentation/power/runtime_pm.txt
drivers/base/power/runtime.c