Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: linux-iio@vger.kernel.org,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Subject: Re: [PATCH v2 6/6] iio: pressure: icp10100: Balance runtime pm + use pm_runtime_resume_and_get()
Date: Wed, 16 Jun 2021 13:56:32 +0100	[thread overview]
Message-ID: <20210616135632.4957386d@jic23-huawei> (raw)
In-Reply-To: <20210616091638.76127362@coco.lan>

On Wed, 16 Jun 2021 09:16:38 +0200
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote:

> Em Sun, 16 May 2021 17:21:03 +0100
> Jonathan Cameron <jic23@kernel.org> escreveu:
> 
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > The devm_ handled runtime pm disable calls pm_runtime_put_sync_suspend()
> > which isn't balancing a matching get call.  It isn't a bug as such,
> > because the runtime pm core doesn't decrement the reference count below
> > zero, but it is missleading so let's drop it.
> > 
> > Using pm_runtime_resume_and_get() new call makes it easy to handle
> > failures in resume as it doesn't hold a reference count if it exits
> > with an error.
> > 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>  
> 
> LGTM.
> 
> Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

Applied.

> 
> > ---
> >  drivers/iio/pressure/icp10100.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/pressure/icp10100.c b/drivers/iio/pressure/icp10100.c
> > index 48759fc4bf18..af4621eaa6b5 100644
> > --- a/drivers/iio/pressure/icp10100.c
> > +++ b/drivers/iio/pressure/icp10100.c
> > @@ -250,7 +250,9 @@ static int icp10100_get_measures(struct icp10100_state *st,
> >  	__be16 measures[3];
> >  	int ret;
> >  
> > -	pm_runtime_get_sync(&st->client->dev);
> > +	ret = pm_runtime_resume_and_get(&st->client->dev);
> > +	if (ret < 0)
> > +		return ret;
> >  
> >  	mutex_lock(&st->lock);
> >  	cmd = &icp10100_cmd_measure[st->mode];
> > @@ -525,7 +527,6 @@ static void icp10100_pm_disable(void *data)
> >  {
> >  	struct device *dev = data;
> >  
> > -	pm_runtime_put_sync_suspend(dev);
> >  	pm_runtime_disable(dev);
> >  }
> >    
> 
> 
> 
> Thanks,
> Mauro


      reply	other threads:[~2021-06-16 12:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-16 16:20 [PATCH v2 0/6] IIO: Runtime PM related cleanups Jonathan Cameron
2021-05-16 16:20 ` [PATCH v2 1/6] iio: imu: mpu6050: Balance runtime pm + use pm_runtime_resume_and_get() Jonathan Cameron
2021-06-16  7:15   ` Mauro Carvalho Chehab
2021-06-16 12:45     ` Jonathan Cameron
2021-05-16 16:20 ` [PATCH v2 2/6] iio: adc: ads1015: Balance runtime pm + pm_runtime_resume_and_get() Jonathan Cameron
2021-06-16  7:15   ` Mauro Carvalho Chehab
2021-06-16 12:46     ` Jonathan Cameron
2021-05-16 16:21 ` [PATCH v2 3/6] iio: chemical: atlas-sensor: " Jonathan Cameron
2021-05-16 19:59   ` Matt Ranostay
2021-06-16  7:16   ` Mauro Carvalho Chehab
2021-06-16 12:47     ` Jonathan Cameron
2021-05-16 16:21 ` [PATCH v2 4/6] iio: prox: pulsed-light-v2: Fix misbalance runtime pm in error path Jonathan Cameron
2021-05-16 19:59   ` Matt Ranostay
2021-06-16  7:18   ` Mauro Carvalho Chehab
2021-06-16 12:54     ` Jonathan Cameron
2021-05-16 16:21 ` [PATCH v2 5/6] iio: prox: pulsed-light-v2: Use pm_runtime_resume_and_get() Jonathan Cameron
2021-05-16 20:01   ` Matt Ranostay
2021-06-16  7:19     ` Mauro Carvalho Chehab
2021-06-16 12:55       ` Jonathan Cameron
2021-05-16 16:21 ` [PATCH v2 6/6] iio: pressure: icp10100: Balance runtime pm + use pm_runtime_resume_and_get() Jonathan Cameron
2021-06-16  7:16   ` Mauro Carvalho Chehab
2021-06-16 12:56     ` Jonathan Cameron [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=20210616135632.4957386d@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=jmaneyrol@invensense.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=mchehab+huawei@kernel.org \
    /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