From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
To: Ulf Hansson <ulf.hansson@linaro.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Wolfram Sang <wsa@the-dreams.de>,
"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
John Stultz <john.stultz@linaro.org>,
Guodong Xu <guodong.xu@linaro.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 02/10] i2c: designware-platdrv: Gate clk in error path in ->probe()
Date: Wed, 15 Jun 2016 15:07:02 +0300 [thread overview]
Message-ID: <0b2b63b3-6c66-fba2-028d-ab366b9df1af@linux.intel.com> (raw)
In-Reply-To: <CAPDyKFpqR5a+b68wMmyY086OCmkiK9mvC-kcav8Q2x28z=0ONA@mail.gmail.com>
On 06/15/2016 10:16 AM, Ulf Hansson wrote:
> On 14 June 2016 at 17:22, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
>> On Tue, 2016-06-14 at 17:07 +0200, Ulf Hansson wrote:
>>> The call to i2c_dw_probe() may fail in ->probe() in which case the
>>> clock
>>> remains ungated. Fix the error path by gating the clock before the
>>> error
>>> code is returned.
>>>
>>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>>> ---
>>> drivers/i2c/busses/i2c-designware-platdrv.c | 10 ++++++++--
>>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c
>>> b/drivers/i2c/busses/i2c-designware-platdrv.c
>>> index e39962b..19174e7 100644
>>> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
>>> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
>>> @@ -235,6 +235,7 @@ static int dw_i2c_plat_probe(struct
>>> platform_device *pdev)
>>> ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));
>>> adap->dev.of_node = pdev->dev.of_node;
>>>
>>
>>
>>> + pm_runtime_get_noresume(&pdev->dev);
>>
>>> + pm_runtime_put(&pdev->dev);
>>
>> I don't see an explanation of these add-ons.
>
> As we explicitly do clk_disable_unprepare() in the error path, we must
> prevent the ->runtime_suspend() callback to be called during this
> period.
>
> This is a common pattern used by many drivers deploying runtime PM
> support, which is probably why I left out the explanation.
>
What would cause here runtime suspend during probe? Also pairing
pm_runtime_get_noresume() with pm_runtime_put() instead of
pm_runtime_put_noidle() looks suspicious to me.
--
Jarkko
next prev parent reply other threads:[~2016-06-15 12:07 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-14 15:07 [PATCH 00/10] i2c: designware-platdrv: Some improvments related to PM Ulf Hansson
2016-06-14 15:07 ` [PATCH 01/10] i2c: designware-platdrv: Return error in ->probe() when clk ungate fails Ulf Hansson
2016-06-15 7:04 ` Jarkko Nikula
2016-06-14 15:07 ` [PATCH 02/10] i2c: designware-platdrv: Gate clk in error path in ->probe() Ulf Hansson
2016-06-14 15:22 ` Andy Shevchenko
2016-06-15 7:16 ` Ulf Hansson
2016-06-15 12:07 ` Jarkko Nikula [this message]
2016-06-20 4:41 ` Ulf Hansson
2016-06-14 15:07 ` [PATCH 03/10] i2c: designware-platdrv: Unconditionally enable runtime PM Ulf Hansson
2016-06-15 12:47 ` Jarkko Nikula
2016-06-20 5:15 ` Ulf Hansson
2016-06-14 15:07 ` [PATCH 04/10] i2c: designware-platdrv: Disable autosuspend in error path in ->probe() Ulf Hansson
2016-06-14 15:07 ` [PATCH 05/10] i2c: designware-platdrv: Fix clk gating in ->remove() Ulf Hansson
2016-06-14 15:07 ` [PATCH 06/10] i2c: designware-platdrv: Update runtime PM last busy mark in ->probe() Ulf Hansson
2016-06-15 13:22 ` Jarkko Nikula
2016-06-14 15:07 ` [PATCH 07/10] i2c: designware-platdrv: Re-init the HW when resuming Ulf Hansson
2016-06-14 15:07 ` [PATCH 08/10] i2c: designware-platdrv: Check return value from clk_prepare_enable() Ulf Hansson
2016-06-14 15:07 ` [PATCH 09/10] i2c: designware-platdrv: Simplify code by using dev_get_drvdata() Ulf Hansson
2016-06-15 11:24 ` Jarkko Nikula
2016-06-14 15:07 ` [PATCH 10/10] i2c: designware-platdrv: Rework system PM support Ulf Hansson
2016-06-14 15:35 ` Andy Shevchenko
2016-06-15 7:52 ` Ulf Hansson
2016-06-14 15:39 ` [PATCH 00/10] i2c: designware-platdrv: Some improvments related to PM Andy Shevchenko
2016-06-15 8:16 ` Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0b2b63b3-6c66-fba2-028d-ab366b9df1af@linux.intel.com \
--to=jarkko.nikula@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=guodong.xu@linaro.org \
--cc=john.stultz@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=ulf.hansson@linaro.org \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).