Re: Re: Re: Re: [PATCH] spi: tegra20-slink: Fix runtime PM imbalance on error

2020-05-23 Thread dinghao . liu
> On Sat, May 23, 2020 at 2:32 PM wrote: > > > > > On Fri, May 22, 2020 at 6:20 PM Andy Shevchenko > > > wrote: > > > > On Fri, May 22, 2020 at 10:46 AM wrote: > > ... > > > I also checked many other implementation of probe in drivers. > > It seems that using pm_runtime_put() is ok. > > In

Re: Re: Re: [PATCH] spi: tegra20-slink: Fix runtime PM imbalance on error

2020-05-23 Thread Andy Shevchenko
On Sat, May 23, 2020 at 2:32 PM wrote: > > > On Fri, May 22, 2020 at 6:20 PM Andy Shevchenko > > wrote: > > > On Fri, May 22, 2020 at 10:46 AM wrote: ... > I also checked many other implementation of probe in drivers. > It seems that using pm_runtime_put() is ok. In *error path* or normal

Re: Re: Re: [PATCH] spi: tegra20-slink: Fix runtime PM imbalance on error

2020-05-23 Thread dinghao . liu
> On Fri, May 22, 2020 at 6:20 PM Andy Shevchenko > wrote: > > On Fri, May 22, 2020 at 10:46 AM wrote: > > ... > > > Moreover, consider below case > > > > CPU1: ...somewhere in the code... > > pm_runtime_get() // with success! > > ...see below... > > pm_runtime_put() > > > > CPU2: ...on

Re: Re: [PATCH] spi: tegra20-slink: Fix runtime PM imbalance on error

2020-05-22 Thread Andy Shevchenko
On Fri, May 22, 2020 at 6:20 PM Andy Shevchenko wrote: > On Fri, May 22, 2020 at 10:46 AM wrote: ... > Moreover, consider below case > > CPU1: ...somewhere in the code... > pm_runtime_get() // with success! > ...see below... > pm_runtime_put() > > CPU2: ...on parallel thread... > ret =

Re: Re: [PATCH] spi: tegra20-slink: Fix runtime PM imbalance on error

2020-05-22 Thread Andy Shevchenko
On Fri, May 22, 2020 at 10:46 AM wrote: > > Hi Andy, > > Thank you for your advice! You are welcome, but please, stop top-posting. > 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

Re: Re: [PATCH] spi: tegra20-slink: Fix runtime PM imbalance on error

2020-05-22 Thread dinghao . liu
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

Re: [PATCH] spi: tegra20-slink: Fix runtime PM imbalance on error

2020-05-21 Thread Jon Hunter
On 21/05/2020 09:38, Jon Hunter wrote: > > On 21/05/2020 09:04, Andy Shevchenko wrote: >> 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 >>>

Re: [PATCH] spi: tegra20-slink: Fix runtime PM imbalance on error

2020-05-21 Thread Jon Hunter
On 21/05/2020 09:04, Andy Shevchenko wrote: > 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

Re: Re: [PATCH] spi: tegra20-slink: Fix runtime PM imbalance on error

2020-05-21 Thread dinghao . liu
Hi Andy, Thank you for your advice! I will fix the problem in the next edition of patch. The coccinelle script will be very helpful and I'm looking forward to it. Regards, Dinghao Andy Shevchenko andy.shevche...@gmail.com写道: > On Thu, May 21, 2020 at 11:04 AM Andy Shevchenko > wrote: > > On

Re: [PATCH] spi: tegra20-slink: Fix runtime PM imbalance on error

2020-05-21 Thread Andy Shevchenko
On Thu, May 21, 2020 at 11:04 AM Andy Shevchenko wrote: > On Thu, May 21, 2020 at 10:50 AM Dinghao Liu wrote: Any I have coccinelle script for this, I can share with you. -- With Best Regards, Andy Shevchenko

Re: [PATCH] spi: tegra20-slink: Fix runtime PM imbalance on error

2020-05-21 Thread Andy Shevchenko
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 =