From patchwork Thu Apr 16 10:10:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Keepax X-Patchwork-Id: 6225051 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3EB599F1AC for ; Thu, 16 Apr 2015 10:16:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5090120172 for ; Thu, 16 Apr 2015 10:16:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 67C71201F4 for ; Thu, 16 Apr 2015 10:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757045AbbDPKQs (ORCPT ); Thu, 16 Apr 2015 06:16:48 -0400 Received: from opensource.wolfsonmicro.com ([80.75.67.52]:35640 "EHLO opensource.wolfsonmicro.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756900AbbDPKQr (ORCPT ); Thu, 16 Apr 2015 06:16:47 -0400 Received: from localhost.localdomain (unknown [87.246.78.26]) by opensource.wolfsonmicro.com (Postfix) with ESMTPSA id C78AE3B40FD; Thu, 16 Apr 2015 11:16:43 +0100 (BST) From: Charles Keepax To: wsa@the-dreams.de Cc: kgene@kernel.org, linux-samsung-soc@vger.kernel.org, linux-i2c@vger.kernel.org, lars@metafoo.de Subject: [PATCH] i2c: s3c2410: Don't enable PM runtime on the adapter device Date: Thu, 16 Apr 2015 11:10:25 +0100 Message-Id: <1429179025-5352-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.7.2.5 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 523c5b89640e ("i2c: Remove support for legacy PM") removed the PM ops from the bus type, which causes the pm operations on the s3c2410 adapter device to fail (-ENOSUPP in rpm_callback). The adapter device doesn't get bound to a driver and as such can't have its own pm_runtime callbacks. Previously this was fine as the bus callbacks would have been used, but now this can cause devices which use PM runtime and are attached over I2C to fail to resume. This commit fixes this issue by just doing the PM operations directly on the I2C device, rather than the adapter device in the driver and adding some stub callbacks for runtime suspend and resume. Signed-off-by: Charles Keepax --- drivers/i2c/busses/i2c-s3c2410.c | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 958c8db..4e6a724 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -784,7 +784,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, int retry; int ret; - pm_runtime_get_sync(&adap->dev); + pm_runtime_get_sync(i2c->dev); ret = clk_enable(i2c->clk); if (ret) return ret; @@ -795,7 +795,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, if (ret != -EAGAIN) { clk_disable(i2c->clk); - pm_runtime_put(&adap->dev); + pm_runtime_put(i2c->dev); return ret; } @@ -805,7 +805,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, } clk_disable(i2c->clk); - pm_runtime_put(&adap->dev); + pm_runtime_put(i2c->dev); return -EREMOTEIO; } @@ -1253,7 +1253,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) platform_set_drvdata(pdev, i2c); pm_runtime_enable(&pdev->dev); - pm_runtime_enable(&i2c->adap.dev); dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev)); return 0; @@ -1270,7 +1269,6 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev) clk_unprepare(i2c->clk); - pm_runtime_disable(&i2c->adap.dev); pm_runtime_disable(&pdev->dev); s3c24xx_i2c_deregister_cpufreq(i2c); @@ -1318,6 +1316,16 @@ static int s3c24xx_i2c_resume_noirq(struct device *dev) #endif #ifdef CONFIG_PM +static int s3c24xx_runtime_resume(struct device *dev) +{ + return 0; +} + +static int s3c24xx_runtime_suspend(struct device *dev) +{ + return 0; +} + static const struct dev_pm_ops s3c24xx_i2c_dev_pm_ops = { #ifdef CONFIG_PM_SLEEP .suspend_noirq = s3c24xx_i2c_suspend_noirq, @@ -1327,6 +1335,9 @@ static const struct dev_pm_ops s3c24xx_i2c_dev_pm_ops = { .poweroff_noirq = s3c24xx_i2c_suspend_noirq, .restore_noirq = s3c24xx_i2c_resume_noirq, #endif + SET_RUNTIME_PM_OPS(s3c24xx_runtime_suspend, + s3c24xx_runtime_resume, + NULL) }; #define S3C24XX_DEV_PM_OPS (&s3c24xx_i2c_dev_pm_ops)