From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757960AbcH3JdG (ORCPT ); Tue, 30 Aug 2016 05:33:06 -0400 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:59657 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752238AbcH3JdE (ORCPT ); Tue, 30 Aug 2016 05:33:04 -0400 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.wolfsonmicro.com From: Charles Keepax To: CC: , Subject: [PATCH] mfd: arizona: Use suspend_noirq inplace of suspend_late Date: Tue, 30 Aug 2016 10:33:10 +0100 Message-ID: <1472549590-4345-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608300092 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/mfd/arizona-core.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index 34a2c26..fe2277d 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c @@ -735,7 +735,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); @@ -759,7 +759,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; @@ -771,10 +771,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); -- 2.1.4