summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2011-05-31 11:39:41 +0530
committersaid m bagheri <ebgheri@steludxu2848.(none)>2011-06-17 13:42:10 +0200
commit4d5aa1e52ab0849925952566cdeea2948a84daf1 (patch)
treeb928225d7ba00ea8b83d0920b806469b1f5c24bc
parente576a6b2e26c0fa7bf4db44b29d622675b4cbb38 (diff)
ux500: pm_runtime: get pins/regulator references on bind
Call ux500_pins_get() and ux500_regulator_get() on bind instead of during the first runtime_resume(), because runtime_resume() can be called in atomic context if the driver uses irq-safe callbacks. ST-Ericsson Linux next: - ST-Ericsson ID: 343071 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: I715e285878149bb4c290e51dae742e14ca17da7e Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/24226 Reviewed-by: QATEST Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
-rw-r--r--arch/arm/mach-ux500/pm/runtime.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/arch/arm/mach-ux500/pm/runtime.c b/arch/arm/mach-ux500/pm/runtime.c
index cb6801b04b1..2d07b2facf8 100644
--- a/arch/arm/mach-ux500/pm/runtime.c
+++ b/arch/arm/mach-ux500/pm/runtime.c
@@ -63,20 +63,18 @@ static struct pm_runtime_data *__to_prd(struct device *dev)
static void platform_pm_runtime_init(struct device *dev,
struct pm_runtime_data *prd)
{
- if (prd && !test_and_set_bit(BIT_ONCE, &prd->flags)) {
- prd->pins = ux500_pins_get(dev_name(dev));
+ prd->pins = ux500_pins_get(dev_name(dev));
- prd->regulator = ux500_regulator_get(dev);
- if (IS_ERR(prd->regulator))
- prd->regulator = NULL;
+ prd->regulator = ux500_regulator_get(dev);
+ if (IS_ERR(prd->regulator))
+ prd->regulator = NULL;
- if (prd->pins || prd->regulator) {
- dev_info(dev, "managed by runtime pm: %s%s\n",
- prd->pins ? "pins " : "",
- prd->regulator ? "regulator " : "");
+ if (prd->pins || prd->regulator) {
+ dev_info(dev, "managed by runtime pm: %s%s\n",
+ prd->pins ? "pins " : "",
+ prd->regulator ? "regulator " : "");
- set_bit(BIT_ACTIVE, &prd->flags);
- }
+ set_bit(BIT_ACTIVE, &prd->flags);
}
}
@@ -87,6 +85,13 @@ static void platform_pm_runtime_bug(struct device *dev,
dev_err(dev, "runtime pm suspend before resume\n");
}
+static void platform_pm_runtime_used(struct device *dev,
+ struct pm_runtime_data *prd)
+{
+ if (prd)
+ set_bit(BIT_ONCE, &prd->flags);
+}
+
static int ux500_pd_runtime_suspend(struct device *dev)
{
struct pm_runtime_data *prd = __to_prd(dev);
@@ -114,7 +119,7 @@ static int ux500_pd_runtime_resume(struct device *dev)
dev_vdbg(dev, "%s()\n", __func__);
- platform_pm_runtime_init(dev, prd);
+ platform_pm_runtime_used(dev, prd);
if (prd && test_bit(BIT_ACTIVE, &prd->flags)) {
if (prd->pins)
@@ -186,9 +191,10 @@ static int ux500_pd_bus_notify(struct notifier_block *nb,
if (action == BUS_NOTIFY_BIND_DRIVER) {
prd = devres_alloc(__devres_release, sizeof(*prd), GFP_KERNEL);
- if (prd)
+ if (prd) {
devres_add(dev, prd);
- else
+ platform_pm_runtime_init(dev, prd);
+ } else
dev_err(dev, "unable to alloc memory for runtime pm\n");
}