[lkml]   [2020]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Re: [PATCH] spi: tegra20-slink: Fix runtime PM imbalance on error
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

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()?

> On Thu, May 21, 2020 at 10:50 AM Dinghao Liu <> 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
 \ /
  Last update: 2020-05-22 09:46    [W:0.052 / U:0.748 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site