Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alain Volmat <alain.volmat@st.com>
To: <dinghao.liu@zju.edu.cn>
Cc: Alexandre Torgue <alexandre.torgue@st.com>,
	kjlu@umn.edu, linux-kernel@vger.kernel.org,
	Pierre-Yves MORDRET <pierre-yves.mordret@st.com>,
	linux-i2c@vger.kernel.org,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: Re: [PATCH] i2c: stm32f7: Fix runtime PM imbalance in stm32f7_i2c_reg_slave
Date: Tue, 26 May 2020 15:25:36 +0200	[thread overview]
Message-ID: <20200526132536.GH14423@gnbcxd0016.gnb.st.com> (raw)
In-Reply-To: <7548c995.d205f.1725111d7c4.Coremail.dinghao.liu@zju.edu.cn>

On Tue, May 26, 2020 at 09:00:23PM +0800, dinghao.liu@zju.edu.cn wrote:
> 
> > Overall, there are several other calls to pm_runtime_get_sync within this
> > driver, would you like to fix them all at once ?
> > 
> 
> Sure, I will send a new patch to merge them all.

Thanks, you might want to add a Fixes: tag in your commit message as well.

> 
> > On Thu, May 21, 2020 at 03:05:07PM +0800, Dinghao Liu wrote:
> > > pm_runtime_get_sync() increments the runtime PM usage counter even
> > > the call returns an error code. Thus a pairing decrement is needed
> > > on the error handling path to keep the counter balanced.
> > > 
> > > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> > > ---
> > >  drivers/i2c/busses/i2c-stm32f7.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
> > > index 330ffed011e0..602cf35649c8 100644
> > > --- a/drivers/i2c/busses/i2c-stm32f7.c
> > > +++ b/drivers/i2c/busses/i2c-stm32f7.c
> > > @@ -1767,8 +1767,10 @@ static int stm32f7_i2c_reg_slave(struct i2c_client *slave)
> > >  		return ret;
> > >  
> > >  	ret = pm_runtime_get_sync(dev);
> > > -	if (ret < 0)
> > > +	if (ret < 0) {
> > > +		pm_runtime_put_autosuspend(dev);
> > 
> > Considering that if we fail here there is a very good chance that this is due
> > to the resume failing, pm_runtime_put_noidle would probably make more sense
> > since pm_runtime_put_autosuspend will most probably fail as well.
> > 
> 
> Agree. Thank you for your advice!
> 
> Regards.
> Dinghao

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2020-05-26 13:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-21  7:05 [PATCH] i2c: stm32f7: Fix runtime PM imbalance in stm32f7_i2c_reg_slave Dinghao Liu
2020-05-26  8:34 ` Alain Volmat
2020-05-26 13:00   ` dinghao.liu
2020-05-26 13:25     ` Alain Volmat [this message]

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=20200526132536.GH14423@gnbcxd0016.gnb.st.com \
    --to=alain.volmat@st.com \
    --cc=alexandre.torgue@st.com \
    --cc=dinghao.liu@zju.edu.cn \
    --cc=kjlu@umn.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=pierre-yves.mordret@st.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