aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/domain.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-07-11 18:39:21 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-07-11 18:39:21 -0400
commitb6c10c84665912985d0bf9b6ae8ce19fc4298d9f (patch)
tree6dd76693427b432646c05633090f390dcc74e2c3 /drivers/base/power/domain.c
parent6f00ff78278fd5d6ac110b6903ee042af2d6af91 (diff)
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/power/domain.c')
-rw-r--r--drivers/base/power/domain.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 0e7e91baec1d..9a20d9302fcd 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)
367static int pm_genpd_prepare(struct device *dev) 367static int pm_genpd_prepare(struct device *dev)
368{ 368{
369 struct generic_pm_domain *genpd; 369 struct generic_pm_domain *genpd;
370 int ret;
370 371
371 dev_dbg(dev, "%s()\n", __func__); 372 dev_dbg(dev, "%s()\n", __func__);
372 373
@@ -400,7 +401,16 @@ static int pm_genpd_prepare(struct device *dev)
400 401
401 mutex_unlock(&genpd->lock); 402 mutex_unlock(&genpd->lock);
402 403
403 return pm_generic_prepare(dev); 404 ret = pm_generic_prepare(dev);
405 if (ret) {
406 mutex_lock(&genpd->lock);
407
408 if (--genpd->prepared_count == 0)
409 genpd->suspend_power_off = false;
410
411 mutex_unlock(&genpd->lock);
412 }
413 return ret;
404} 414}
405 415
406/** 416/**