[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201107101106.37747.rjw@sisk.pl>
Date: Sun, 10 Jul 2011 11:06:37 +0200
From: "Rafael J. Wysocki" <rjw@...k.pl>
To: Linux PM mailing list <linux-pm@...ts.linux-foundation.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Kevin Hilman <khilman@...com>,
Alan Stern <stern@...land.harvard.edu>,
MyungJoo Ham <myungjoo.ham@...sung.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Paul Walmsley <paul@...an.com>, Greg KH <gregkh@...e.de>,
Magnus Damm <magnus.damm@...il.com>
Subject: [PATCH 2/6 v2] PM / Domains: Make failing pm_genpd_prepare() clean up properly
From: Rafael J. Wysocki <rjw@...k.pl>
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@...k.pl>
---
drivers/base/power/domain.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
Index: linux-2.6/drivers/base/power/domain.c
===================================================================
--- linux-2.6.orig/drivers/base/power/domain.c
+++ linux-2.6/drivers/base/power/domain.c
@@ -367,6 +367,7 @@ static void pm_genpd_sync_poweroff(struc
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 devic
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;
}
/**
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists