Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/810338/?format=api
{ "id": 810338, "url": "http://patchwork.ozlabs.org/api/patches/810338/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/patch/6171713.W6ZzihW19R@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": "<6171713.W6ZzihW19R@aspire.rjw.lan>", "list_archive_url": null, "date": "2017-09-05T23:43:48", "name": "[RFT,v3,1/3] 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/6171713.W6ZzihW19R@aspire.rjw.lan/mbox/", "series": [ { "id": 1671, "url": "http://patchwork.ozlabs.org/api/series/1671/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/list/?series=1671", "date": "2017-09-05T23:46:01", "name": "i2c: designware: Runtime PM aware system sleep handling", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/1671/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/810338/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/810338/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 3xn3fj3lrhz9sPr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 6 Sep 2017 10:02:05 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1754589AbdIFACC (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tTue, 5 Sep 2017 20:02:02 -0400", "from cloudserver094114.home.net.pl ([79.96.170.134]:64338 \"EHLO\n\tcloudserver094114.home.net.pl\" rhost-flags-OK-OK-OK-OK)\n\tby vger.kernel.org with ESMTP id S1754580AbdIFAB4 (ORCPT\n\t<rfc822;linux-i2c@vger.kernel.org>); Tue, 5 Sep 2017 20:01:56 -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 573671065c2fc958; Wed, 6 Sep 2017 02:01:54 +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>,\n\tLee Jones <lee@kernel.org>", "Subject": "[RFT][PATCH v3 1/3] i2c: designware: Clean up PM handling in\n\tdw_i2c_plat_probe()", "Date": "Wed, 06 Sep 2017 01:43:48 +0200", "Message-ID": "<6171713.W6ZzihW19R@aspire.rjw.lan>", "In-Reply-To": "<3958866.l2qnKDbinI@aspire.rjw.lan>", "References": "<3023226.l5IfJK6GIc@aspire.rjw.lan>\n\t<3958866.l2qnKDbinI@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.\n\nSigned-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>\n---\n\n-> v3: Small update of the changelog.\n\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", "v3", "1/3" ] }