From patchwork Thu Aug 25 11:23:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 74677 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp788260qga; Thu, 25 Aug 2016 04:30:31 -0700 (PDT) X-Received: by 10.66.79.138 with SMTP id j10mr15241866pax.60.1472124631925; Thu, 25 Aug 2016 04:30:31 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tz10si15156456pab.71.2016.08.25.04.30.31; Thu, 25 Aug 2016 04:30:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754030AbcHYLab (ORCPT + 1 other); Thu, 25 Aug 2016 07:30:31 -0400 Received: from foss.arm.com ([217.140.101.70]:56998 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757820AbcHYLa3 (ORCPT ); Thu, 25 Aug 2016 07:30:29 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D09A84F6; Thu, 25 Aug 2016 04:25:27 -0700 (PDT) Received: from e107155-lin.cambridge.arm.com (unknown [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 383523F220; Thu, 25 Aug 2016 04:23:46 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Sudeep Holla , Andy Gross , David Brown , Wolfram Sang Subject: [PATCH] i2c: qup: skip qup_i2c_suspend if the device is already runtime suspended Date: Thu, 25 Aug 2016 12:23:39 +0100 Message-Id: <1472124219-1627-1-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org If the i2c device is already runtime suspended, if qup_i2c_suspend is executed during suspend-to-idle or suspend-to-ram it will result in the following splat: WARNING: CPU: 3 PID: 1593 at drivers/clk/clk.c:476 clk_core_unprepare+0x80/0x90 Modules linked in: CPU: 3 PID: 1593 Comm: bash Tainted: G W 4.8.0-rc3 #14 Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT) PC is at clk_core_unprepare+0x80/0x90 LR is at clk_unprepare+0x28/0x40 pc : [] lr : [] pstate: 60000145 Call trace: clk_core_unprepare+0x80/0x90 qup_i2c_disable_clocks+0x2c/0x68 qup_i2c_suspend+0x10/0x20 platform_pm_suspend+0x24/0x68 dpm_run_callback.isra.7+0x1c/0x70 __device_suspend+0xf4/0x298 dpm_suspend+0x10c/0x228 dpm_suspend_start+0x68/0x78 suspend_devices_and_enter+0xb8/0x460 pm_suspend+0x1ec/0x240 state_store+0x84/0xf8 kobj_attr_store+0x14/0x28 sysfs_kf_write+0x48/0x58 kernfs_fop_write+0x15c/0x1f8 __vfs_write+0x1c/0x100 vfs_write+0x9c/0x1b8 SyS_write+0x44/0xa0 el0_svc_naked+0x24/0x28 This patch fixes the issue by executing qup_i2c_pm_suspend_runtime conditionally in qup_i2c_suspend. Cc: Andy Gross Cc: David Brown Cc: Wolfram Sang Signed-off-by: Sudeep Holla --- drivers/i2c/busses/i2c-qup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index 501bd15cb78e..a8497cfdae6f 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -1599,7 +1599,8 @@ static int qup_i2c_pm_resume_runtime(struct device *device) #ifdef CONFIG_PM_SLEEP static int qup_i2c_suspend(struct device *device) { - qup_i2c_pm_suspend_runtime(device); + if (!pm_runtime_suspended(device)) + return qup_i2c_pm_suspend_runtime(device); return 0; }