This is a note to let you know that I've just added the patch titled
PM: Fix async resume following suspend failure
to the 2.6.39-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
pm-fix-async-resume-following-suspend-failure.patch
and it can be found in the queue-2.6.39 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.
>From 6d0e0e84f66d32c33511984dd3badd32364b863c Mon Sep 17 00:00:00 2001
From: Alan Stern <[email protected]>
Date: Sat, 18 Jun 2011 22:42:09 +0200
Subject: PM: Fix async resume following suspend failure
From: Alan Stern <[email protected]>
commit 6d0e0e84f66d32c33511984dd3badd32364b863c upstream.
The PM core doesn't handle suspend failures correctly when it comes to
asynchronously suspended devices. These devices are moved onto the
dpm_suspended_list as soon as the corresponding async thread is
started up, and they remain on the list even if they fail to suspend
or the sleep transition is cancelled before they get suspended. As a
result, when the PM core unwinds the transition, it tries to resume
the devices even though they were never suspended.
This patch (as1474) fixes the problem by adding a new "is_suspended"
flag to dev_pm_info. Devices are resumed only if the flag is set.
[rjw:
* Moved the dev->power.is_suspended check into device_resume(),
because we need to complete dev->power.completion and clear
dev->power.is_prepared too for devices whose
dev->power.is_suspended flags are unset.
* Fixed __device_suspend() to avoid setting dev->power.is_suspended
if async_error is different from zero.]
Signed-off-by: Alan Stern <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/base/power/main.c | 14 ++++++++++++--
include/linux/pm.h | 1 +
2 files changed, 13 insertions(+), 2 deletions(-)
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -58,6 +58,7 @@ static int async_error;
void device_pm_init(struct device *dev)
{
dev->power.is_prepared = false;
+ dev->power.is_suspended = false;
init_completion(&dev->power.completion);
complete_all(&dev->power.completion);
dev->power.wakeup = NULL;
@@ -519,6 +520,9 @@ static int device_resume(struct device *
*/
dev->power.is_prepared = false;
+ if (!dev->power.is_suspended)
+ goto Unlock;
+
if (dev->pwr_domain) {
pm_dev_dbg(dev, state, "power domain ");
pm_op(dev, &dev->pwr_domain->ops, state);
@@ -553,6 +557,9 @@ static int device_resume(struct device *
}
End:
+ dev->power.is_suspended = false;
+
+ Unlock:
device_unlock(dev);
complete_all(&dev->power.completion);
@@ -838,11 +845,11 @@ static int __device_suspend(struct devic
device_lock(dev);
if (async_error)
- goto End;
+ goto Unlock;
if (pm_wakeup_pending()) {
async_error = -EBUSY;
- goto End;
+ goto Unlock;
}
if (dev->type && dev->type->pm) {
@@ -880,6 +887,9 @@ static int __device_suspend(struct devic
}
End:
+ dev->power.is_suspended = !error;
+
+ Unlock:
device_unlock(dev);
complete_all(&dev->power.completion);
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -426,6 +426,7 @@ struct dev_pm_info {
unsigned int can_wakeup:1;
unsigned int async_suspend:1;
bool is_prepared:1; /* Owned by the PM core */
+ bool is_suspended:1; /* Ditto */
spinlock_t lock;
#ifdef CONFIG_PM_SLEEP
struct list_head entry;
Patches currently in stable-queue which might be from [email protected]
are
queue-2.6.39/usb-free-bandwidth-when-usb_disable_device-is-called.patch
queue-2.6.39/pm-fix-async-resume-following-suspend-failure.patch
queue-2.6.39/usb-fix-regression-occurring-during-device-removal.patch
queue-2.6.39/pm-rename-dev_pm_info.in_suspend-to-is_prepared.patch
queue-2.6.39/usb-don-t-let-the-hub-driver-prevent-system-sleep.patch
queue-2.6.39/usb-don-t-let-errors-prevent-system-sleep.patch
_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable