PM / Runtime: don't forget to wake up waitqueue on failure
authorAlan Stern <stern@rowland.harvard.edu>
Mon, 26 Mar 2012 20:46:52 +0000 (22:46 +0200)
committerVarun Wadekar <vwadekar@nvidia.com>
Wed, 18 Apr 2012 13:07:20 +0000 (18:07 +0530)
commitc6564361fa984c39bf00acebd1aecdfc11840929
treef4bd31185a91d2f3a5a6779ad386fd68b3895162
parent57ab8e1b1722147fd892b3f91cffec6f4e4f31da
PM / Runtime: don't forget to wake up waitqueue on failure

This patch (as1535) fixes a bug in the runtime PM core.  When a
runtime suspend attempt completes, whether successfully or not, the
device's power.wait_queue is supposed to be signalled.  But this
doesn't happen in the failure pathway of rpm_suspend() when another
autosuspend attempt is rescheduled.  As a result, a task can get stuck
indefinitely on the wait queue (I have seen this happen in testing).

The patch fixes the problem by moving the wake_up_all() call up near
the start of the failure code.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
drivers/base/power/runtime.c