[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1365597549.12565.4.camel@cliu38-desktop-build>
Date: Wed, 10 Apr 2013 20:39:09 +0800
From: Chuansheng Liu <chuansheng.liu@...el.com>
To: broonie@...nsource.wolfsonmicro.com, sameo@...ux.intel.com
Cc: linux-kernel@...r.kernel.org, patches@...nsource.wolfsonmicro.com,
chuansheng.liu@...el.com
Subject: mfd, arizona: Fix the deadlock between interrupt handler and
dpm_suspend
When system try to do the suspend:
T1:suspend_thread T2: interrupt thread handler
enter_state() arizona_irq_thread()
suspend_devices_and_enter() regmap_read()
__device_suspend()
regmap_spi_read()
spi_write_then_read()
spi_sync()
__spi_sync()
wait_for_completion()
T2 <== Blocked here due to spi suspended
suspend_enter()
dpm_suspend_end()
dpm_suspend_noirq()
suspend_device_irqs()
synchronize_irq()
T1 <== Blocked here due waiting for T2 finished
Then T1 and T2 is deadlocked there.
Here the arizona irq is not NOSUSPEND irq, so when doing device suspend,
we can disable the arizona irq, and enable it until devices resuming finished.
Signed-off-by: liu chuansheng <chuansheng.liu@...el.com>
---
drivers/mfd/arizona-core.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index b562c7b..b11bd01 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -264,11 +264,11 @@ static int arizona_runtime_suspend(struct device *dev)
#endif
#ifdef CONFIG_PM_SLEEP
-static int arizona_resume_noirq(struct device *dev)
+static int arizona_suspend(struct device *dev)
{
struct arizona *arizona = dev_get_drvdata(dev);
- dev_dbg(arizona->dev, "Early resume, disabling IRQ\n");
+ dev_dbg(arizona->dev, "Suspend, disabling IRQ\n");
disable_irq(arizona->irq);
return 0;
@@ -278,7 +278,7 @@ static int arizona_resume(struct device *dev)
{
struct arizona *arizona = dev_get_drvdata(dev);
- dev_dbg(arizona->dev, "Late resume, reenabling IRQ\n");
+ dev_dbg(arizona->dev, "Resume, reenabling IRQ\n");
enable_irq(arizona->irq);
return 0;
@@ -289,10 +289,7 @@ const struct dev_pm_ops arizona_pm_ops = {
SET_RUNTIME_PM_OPS(arizona_runtime_suspend,
arizona_runtime_resume,
NULL)
- SET_SYSTEM_SLEEP_PM_OPS(NULL, arizona_resume)
-#ifdef CONFIG_PM_SLEEP
- .resume_noirq = arizona_resume_noirq,
-#endif
+ SET_SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume)
};
EXPORT_SYMBOL_GPL(arizona_pm_ops);
--
1.7.0.4
--
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