public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* mfd, arizona: Fix the deadlock between interrupt handler and dpm_suspend
@ 2013-04-10 12:39 Chuansheng Liu
  2013-04-10 12:30 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Chuansheng Liu @ 2013-04-10 12:39 UTC (permalink / raw)
  To: broonie, sameo; +Cc: linux-kernel, patches, chuansheng.liu


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@intel.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




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-10 12:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-10 12:39 mfd, arizona: Fix the deadlock between interrupt handler and dpm_suspend Chuansheng Liu
2013-04-10 12:30 ` Mark Brown
2013-04-10 12:46   ` Liu, Chuansheng
2013-04-10 12:52     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox