From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: Re: [PATCH v4 1/3] PM: i2c-designware-platdrv: Clean up PM handling in probe Date: Mon, 25 Sep 2017 22:45:31 +0200 Message-ID: <3491198.ZaBooUSjR1@aspire.rjw.lan> References: <3023226.l5IfJK6GIc@aspire.rjw.lan> <2813826.3DA0fVXnVa@aspire.rjw.lan> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Return-path: In-Reply-To: Sender: linux-pm-owner@vger.kernel.org To: Ulf Hansson Cc: "linux-pm@vger.kernel.org" , Wolfram Sang , "linux-i2c@vger.kernel.org" , ACPI Devel Maling List , Kevin Hilman , Jarkko Nikula , Andy Shevchenko , Mika Westerberg , Jisheng Zhang , John Stultz , Guodong Xu , Sumit Semwal , Haojian Zhuang , Johannes Stezenbach , Lee Jones , Rajat Jain List-Id: linux-acpi@vger.kernel.org On Monday, September 25, 2017 9:12:28 PM CEST Ulf Hansson wrote: > On 25 September 2017 at 01:17, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > > > The power management handling in dw_i2c_plat_probe() is somewhat > > messy and it is rather hard to figure out the code intention for > > the case when pm_disabled is set. In that case, the driver doesn't > > enable runtime PM at all, but in addition to that it calls > > pm_runtime_forbid() as though it wasn't sure if runtime PM might > > be enabled for the device later by someone else. > > > > Although that concern doesn't seem to be actually valid, the > > device is clearly still expected to be PM-capable even in the > > pm_disabled set case, so a better approach would be to enable > > runtime PM for it unconditionally and then prevent it from > > being runtime-suspended by using pm_runtime_forbid(). > > This is nice cleanup! However I have one suggestion/comment. > > Using pm_runtime_forbid() to prevent the device from being runtime > suspended may be a bit fragile, as userspace can then still change to > "allow" it. Wouldn't it be better to bump the runtime PM usage count > (pm_runtime_get_noresume()) instead? Right, this is not a PCI driver. :-) I'll send an update of this patch shortly. Thanks, Rafael