]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mfd: arizona: Use suspend_noirq inplace of suspend_late
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Tue, 30 Aug 2016 09:33:10 +0000 (10:33 +0100)
committerLee Jones <lee.jones@linaro.org>
Tue, 4 Oct 2016 14:48:03 +0000 (15:48 +0100)
As runtime PM doesn't function whilst processing system suspend/resume
operations and the Arizona IRQ handlers need runtime PM to function
we must disable IRQs during these operations. Whilst this is
already done in the driver we are using suspend/suspend_late and
resume/resume_noirq to do so which has two problems. Firstly, as
suspend_late is before suspend_noirq that means we still have a
small window where an IRQ can cause issues.  Secondly, if another
suspend_late handler fails after ours has run then (as resume_noirq
will not run) we will make unbalanced calls to enable_irq.

This is all simply fixed by using the suspend_noirq callback rather
than suspend_late. Whilst we are doing this tidy the code up a little,
and use the appropriate helper macros.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/arizona-core.c

index fcec650ca0884f575bd0965bf9a4dd0bf76ac8d8..4c18c8ef05d958ae837e9b6131f4b91dfb168873 100644 (file)
@@ -750,7 +750,7 @@ static int arizona_suspend(struct device *dev)
        return 0;
 }
 
-static int arizona_suspend_late(struct device *dev)
+static int arizona_suspend_noirq(struct device *dev)
 {
        struct arizona *arizona = dev_get_drvdata(dev);
 
@@ -774,7 +774,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;
@@ -786,10 +786,8 @@ const struct dev_pm_ops arizona_pm_ops = {
                           arizona_runtime_resume,
                           NULL)
        SET_SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume)
-#ifdef CONFIG_PM_SLEEP
-       .suspend_late = arizona_suspend_late,
-       .resume_noirq = arizona_resume_noirq,
-#endif
+       SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(arizona_suspend_noirq,
+                                     arizona_resume_noirq)
 };
 EXPORT_SYMBOL_GPL(arizona_pm_ops);