From: dinghao.liu@zju.edu.cn
To: "Andy Shevchenko" <andy.shevchenko@gmail.com>
Cc: "Kangjie Lu" <kjlu@umn.edu>,
"Laxman Dewangan" <ldewangan@nvidia.com>,
"Mark Brown" <broonie@kernel.org>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
linux-spi <linux-spi@vger.kernel.org>,
linux-tegra@vger.kernel.org,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: Re: [PATCH] spi: tegra20-slink: Fix runtime PM imbalance on error
Date: Fri, 22 May 2020 15:45:58 +0800 (GMT+08:00) [thread overview]
Message-ID: <5a8a6e7b.bef25.1723b588c7f.Coremail.dinghao.liu@zju.edu.cn> (raw)
In-Reply-To: <CAHp75VfOeUaqRW2vRwyWaz3JJw41hX5jTgE+kZ8pB8E_HtHwqw@mail.gmail.com>
Hi Andy,
Thank you for your advice!
Your suggestion is to use pm_runtime_put_noidle(), right?
The only difference between pm_runtime_put() and this function
is that pm_runtime_put() will run an extra pm_request_idle().
I checked this patched function again and found there is a
pm_runtime_put() in the normal branch of pm_runtime_get_sync().
Does this mean the original program logic need to execute idle
callback?
According to runtime PM's doc, the pm_runtime_get_sync() call
paired with a pm_runtime_put() call will be appropriate to ensure
that the device is not put back to sleep during the probe. Therefore
I think pm_runtime_put() is more appropriate here. Do you have
more detailed suggestion for why we should use _put_noidle()?
Regards,
Dinghao
> On Thu, May 21, 2020 at 10:50 AM Dinghao Liu <dinghao.liu@zju.edu.cn> wrote:
> >
> > pm_runtime_get_sync() increments the runtime PM usage counter even
> > when it returns an error code. Thus a pairing decrement is needed on
> > the error handling path to keep the counter balanced.
>
> ...
>
> > ret = pm_runtime_get_sync(&pdev->dev);
> > if (ret < 0) {
> > dev_err(&pdev->dev, "pm runtime get failed, e = %d\n", ret);
>
> > + pm_runtime_put(&pdev->dev);
>
> For all your patches, please, double check what you are proposing.
>
> Here, I believe, the correct one will be _put_noidle().
>
> AFAIU you are not supposed to actually suspend the device in case of error.
> But I might be mistaken, thus see above.
>
> > goto exit_pm_disable;
> > }
>
> --
> With Best Regards,
> Andy Shevchenko
next prev parent reply other threads:[~2020-05-22 7:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-21 7:49 [PATCH] spi: tegra20-slink: Fix runtime PM imbalance on error Dinghao Liu
2020-05-21 8:04 ` Andy Shevchenko
2020-05-21 8:06 ` Andy Shevchenko
2020-05-21 8:24 ` dinghao.liu
2020-05-21 8:38 ` Jon Hunter
2020-05-21 8:46 ` Jon Hunter
2020-05-22 7:45 ` dinghao.liu [this message]
2020-05-22 15:20 ` Andy Shevchenko
2020-05-22 15:22 ` Andy Shevchenko
2020-05-23 11:32 ` dinghao.liu
2020-05-23 11:52 ` Andy Shevchenko
2020-05-23 12:04 ` dinghao.liu
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=5a8a6e7b.bef25.1723b588c7f.Coremail.dinghao.liu@zju.edu.cn \
--to=dinghao.liu@zju.edu.cn \
--cc=andy.shevchenko@gmail.com \
--cc=broonie@kernel.org \
--cc=jonathanh@nvidia.com \
--cc=kjlu@umn.edu \
--cc=ldewangan@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@gmail.com \
/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).