Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/809487/?format=api
{ "id": 809487, "url": "http://patchwork.ozlabs.org/api/patches/809487/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/patch/57866801.UnLEtqmHq8@aspire.rjw.lan/", "project": { "id": 35, "url": "http://patchwork.ozlabs.org/api/projects/35/?format=api", "name": "Linux I2C development", "link_name": "linux-i2c", "list_id": "linux-i2c.vger.kernel.org", "list_email": "linux-i2c@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<57866801.UnLEtqmHq8@aspire.rjw.lan>", "list_archive_url": null, "date": "2017-09-03T23:08:32", "name": "[RFT,1/2] i2c: designware: Clean up PM handling in dw_i2c_plat_probe()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "55f273751e1c4df14369388f454f1f77050ae02e", "submitter": { "id": 26536, "url": "http://patchwork.ozlabs.org/api/people/26536/?format=api", "name": "Rafael J. Wysocki", "email": "rjw@rjwysocki.net" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-i2c/patch/57866801.UnLEtqmHq8@aspire.rjw.lan/mbox/", "series": [ { "id": 1289, "url": "http://patchwork.ozlabs.org/api/series/1289/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/list/?series=1289", "date": "2017-09-03T23:14:44", "name": "i2c: designware: Runtime PM aware system sleep handling", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1289/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/809487/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/809487/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-i2c-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-i2c-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xlpx44WMPz9t0F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 4 Sep 2017 09:25:12 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753020AbdICXZH (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tSun, 3 Sep 2017 19:25:07 -0400", "from cloudserver094114.home.net.pl ([79.96.170.134]:49181 \"EHLO\n\tcloudserver094114.home.net.pl\" rhost-flags-OK-OK-OK-OK)\n\tby vger.kernel.org with ESMTP id S1753090AbdICXZG (ORCPT\n\t<rfc822;linux-i2c@vger.kernel.org>); Sun, 3 Sep 2017 19:25:06 -0400", "from 79.184.253.199.ipv4.supernova.orange.pl (79.184.253.199)\n\t(HELO aspire.rjw.lan)\n\tby serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer\n\t0.82) id efe0b0ad6627dbb2; Mon, 4 Sep 2017 01:25:04 +0200" ], "From": "\"Rafael J. Wysocki\" <rjw@rjwysocki.net>", "To": "linux-pm@vger.kernel.org, linux-i2c@vger.kernel.org", "Cc": "Wolfram Sang <wsa@the-dreams.de>, linux-acpi@vger.kernel.org,\n\tKevin Hilman <khilman@kernel.org>,\n\tJarkko Nikula <jarkko.nikula@linux.intel.com>,\n\tAndy Shevchenko <andriy.shevchenko@linux.intel.com>,\n\tMika Westerberg <mika.westerberg@linux.intel.com>,\n\tJisheng Zhang <jszhang@marvell.com>,\n\tJohn Stultz <john.stultz@linaro.org>, Guodong Xu <guodong.xu@linaro.org>,\n\tSumit Semwal <sumit.semwal@linaro.org>,\n\tHaojian Zhuang <haojian.zhuang@linaro.org>,\n\tJohannes Stezenbach <js@sig21.net>, Ulf Hansson <ulf.hansson@linaro.org>", "Subject": "[RFT][PATCH 1/2] i2c: designware: Clean up PM handling in\n\tdw_i2c_plat_probe()", "Date": "Mon, 04 Sep 2017 01:08:32 +0200", "Message-ID": "<57866801.UnLEtqmHq8@aspire.rjw.lan>", "In-Reply-To": "<3023226.l5IfJK6GIc@aspire.rjw.lan>", "References": "<3023226.l5IfJK6GIc@aspire.rjw.lan>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "7Bit", "Content-Type": "text/plain; charset=\"us-ascii\"", "Sender": "linux-i2c-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-i2c.vger.kernel.org>", "X-Mailing-List": "linux-i2c@vger.kernel.org" }, "content": "From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>\n\nThe power management handling in dw_i2c_plat_probe() is somewhat\nmessy and it is rather hard to figure out the code intention for\nthe case when pm_disabled is set. In that case, the driver doesn't\nenable runtime PM at all, but in addition to that it calls\npm_runtime_forbid() as though it wasn't sure if runtime PM might\nbe enabled for the device later by someone else.\n\nAlthough that concern doesn't seem to be actually valid, the\ndevice is clearly still expected to be PM-capable even in the\npm_disabled set case, so a better approach would be to enable\nruntime PM for it unconditionally and then prevent it from\nbeing runtime suspended by using pm_runtime_forbid().\n\nMake the driver do that as that will help to clean up its system\nsleep handling in a relatively straightforward way.\n\nSigned-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>\n---\n drivers/i2c/busses/i2c-designware-platdrv.c | 36 +++++++++++++++++++---------\n 1 file changed, 25 insertions(+), 11 deletions(-)", "diff": "Index: linux-pm/drivers/i2c/busses/i2c-designware-platdrv.c\n===================================================================\n--- linux-pm.orig/drivers/i2c/busses/i2c-designware-platdrv.c\n+++ linux-pm/drivers/i2c/busses/i2c-designware-platdrv.c\n@@ -249,6 +249,16 @@ static void dw_i2c_set_fifo_size(struct\n \t}\n }\n \n+static void dw_i2c_plat_pm_cleanup(struct dw_i2c_dev *dev)\n+{\n+\tpm_runtime_get_noresume(dev->dev);\n+\tif (dev->pm_disabled)\n+\t\tpm_runtime_allow(dev->dev);\n+\n+\tpm_runtime_disable(dev->dev);\n+\tpm_runtime_put_noidle(dev->dev);\n+}\n+\n static int dw_i2c_plat_probe(struct platform_device *pdev)\n {\n \tstruct dw_i2c_platform_data *pdata = dev_get_platdata(&pdev->dev);\n@@ -362,14 +372,19 @@ static int dw_i2c_plat_probe(struct plat\n \tACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));\n \tadap->dev.of_node = pdev->dev.of_node;\n \n-\tif (dev->pm_disabled) {\n+\t/* The code below assumes runtime PM to be disabled. */\n+\tWARN_ON(pm_runtime_enabled(&pdev->dev));\n+\n+\tpm_runtime_set_autosuspend_delay(&pdev->dev, 1000);\n+\tpm_runtime_use_autosuspend(&pdev->dev);\n+\tpm_runtime_set_active(&pdev->dev);\n+\n+\tpm_runtime_get_noresume(&pdev->dev);\n+\tpm_runtime_enable(&pdev->dev);\n+\tif (dev->pm_disabled)\n \t\tpm_runtime_forbid(&pdev->dev);\n-\t} else {\n-\t\tpm_runtime_set_autosuspend_delay(&pdev->dev, 1000);\n-\t\tpm_runtime_use_autosuspend(&pdev->dev);\n-\t\tpm_runtime_set_active(&pdev->dev);\n-\t\tpm_runtime_enable(&pdev->dev);\n-\t}\n+\n+\tpm_runtime_put_noidle(&pdev->dev);\n \n \tif (dev->mode == DW_IC_SLAVE)\n \t\tret = i2c_dw_probe_slave(dev);\n@@ -382,8 +397,7 @@ static int dw_i2c_plat_probe(struct plat\n \treturn ret;\n \n exit_probe:\n-\tif (!dev->pm_disabled)\n-\t\tpm_runtime_disable(&pdev->dev);\n+\tdw_i2c_plat_pm_cleanup(dev);\n exit_reset:\n \tif (!IS_ERR_OR_NULL(dev->rst))\n \t\treset_control_assert(dev->rst);\n@@ -402,8 +416,8 @@ static int dw_i2c_plat_remove(struct pla\n \n \tpm_runtime_dont_use_autosuspend(&pdev->dev);\n \tpm_runtime_put_sync(&pdev->dev);\n-\tif (!dev->pm_disabled)\n-\t\tpm_runtime_disable(&pdev->dev);\n+\tdw_i2c_plat_pm_cleanup(dev);\n+\n \tif (!IS_ERR_OR_NULL(dev->rst))\n \t\treset_control_assert(dev->rst);\n \n", "prefixes": [ "RFT", "1/2" ] }