From patchwork Wed Oct 17 15:33:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 1697881 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 9A521DF2AB for ; Mon, 5 Nov 2012 14:25:11 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TVNYs-00020j-MR; Mon, 05 Nov 2012 14:21:59 +0000 Received: from arroyo.ext.ti.com ([192.94.94.40]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TOVif-0007iT-Jk for linux-arm-kernel@lists.infradead.org; Wed, 17 Oct 2012 15:39:43 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id q9HFddOo002426; Wed, 17 Oct 2012 10:39:39 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q9HFddJI001362; Wed, 17 Oct 2012 10:39:39 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Wed, 17 Oct 2012 10:39:39 -0500 Received: from localhost (h68-7.vpn.ti.com [172.24.68.7]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id q9HFdcIh021531; Wed, 17 Oct 2012 10:39:38 -0500 From: Felipe Balbi To: Tony Lindgren Subject: [RFC/NOT FOR MERGING 1/5] arm: omap: fix up _od_suspend_noirq and _od_resume_noirq Date: Wed, 17 Oct 2012 18:33:59 +0300 Message-ID: <1350488043-5053-2-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.8.0.rc0 In-Reply-To: <1350488043-5053-1-git-send-email-balbi@ti.com> References: <1350488043-5053-1-git-send-email-balbi@ti.com> MIME-Version: 1.0 X-Bad-Reply: References and In-Reply-To but no 'Re:' in Subject. X-Spam-Note: CRM114 invocation failed X-Spam-Score: -7.3 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.94.94.40 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Mailman-Approved-At: Mon, 05 Nov 2012 09:14:09 -0500 Cc: Kevin Hilman , Paul Walmsley , Felipe Balbi , Santosh Shilimkar , Linux OMAP Mailing List , Linux ARM Kernel Mailing List X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org current implementation doesn't take care about drivers which don't provide *_noirq methods and we could fall into a situation where we would suspend/resume devices even though they haven't asked for it. One such case happened with the I2C driver which was getting suspended during suspend_noirq() just to be resume right after by any other device doing an I2C transfer on its suspend method. Signed-off-by: Felipe Balbi --- arch/arm/plat-omap/omap_device.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c index 7a7d1f2..935f416 100644 --- a/arch/arm/plat-omap/omap_device.c +++ b/arch/arm/plat-omap/omap_device.c @@ -804,8 +804,12 @@ static int _od_suspend_noirq(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct omap_device *od = to_omap_device(pdev); + const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; int ret; + if (!pm || !pm->suspend_noirq) + return 0; + /* Don't attempt late suspend on a driver that is not bound */ if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) return 0; @@ -827,6 +831,10 @@ static int _od_resume_noirq(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct omap_device *od = to_omap_device(pdev); + const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; + + if (!pm || !pm->resume_noirq) + return 0; if ((od->flags & OMAP_DEVICE_SUSPENDED) && !pm_runtime_status_suspended(dev)) {