diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2011-07-12 00:39:21 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2011-07-12 00:39:21 +0200 |
commit | b6c10c84665912985d0bf9b6ae8ce19fc4298d9f (patch) | |
tree | 6dd76693427b432646c05633090f390dcc74e2c3 /drivers/base | |
parent | 6f00ff78278fd5d6ac110b6903ee042af2d6af91 (diff) | |
download | op-kernel-dev-b6c10c84665912985d0bf9b6ae8ce19fc4298d9f.zip op-kernel-dev-b6c10c84665912985d0bf9b6ae8ce19fc4298d9f.tar.gz |
PM / Domains: Make failing pm_genpd_prepare() clean up properly
If pm_generic_prepare() in pm_genpd_prepare() returns error code,
the PM domains counter of "prepared" devices should be decremented
and its suspend_power_off flag should be reset if this counter drops
down to zero. Otherwise, the PM domain runtime PM code will not
handle the domain correctly (it will permanently think that system
suspend is in progress).
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/power/domain.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 0e7e91b..9a20d93 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -367,6 +367,7 @@ static void pm_genpd_sync_poweroff(struct generic_pm_domain *genpd) static int pm_genpd_prepare(struct device *dev) { struct generic_pm_domain *genpd; + int ret; dev_dbg(dev, "%s()\n", __func__); @@ -400,7 +401,16 @@ static int pm_genpd_prepare(struct device *dev) mutex_unlock(&genpd->lock); - return pm_generic_prepare(dev); + ret = pm_generic_prepare(dev); + if (ret) { + mutex_lock(&genpd->lock); + + if (--genpd->prepared_count == 0) + genpd->suspend_power_off = false; + + mutex_unlock(&genpd->lock); + } + return ret; } /** |