On Wed, 12 May 2021 17:00:04 +0200 Mauro Carvalho Chehab <mchehab@xxxxxxxxxx> wrote: > Em Sun, 9 May 2021 12:33:53 +0100 > Jonathan Cameron <jic23@xxxxxxxxxx> escreveu: > > > From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > > > > Using this 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@xxxxxxxxxx> > > Cc: Jean-Baptiste Maneyrol <jmaneyrol@xxxxxxxxxxxxxx> > > --- > > drivers/iio/pressure/icp10100.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/iio/pressure/icp10100.c b/drivers/iio/pressure/icp10100.c > > index 48759fc4bf18..80cd66688731 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]; > > > This one has a logic similar to a patch I commented earlier in this > series. At probing time, it does: > > pm_runtime_get_noresume(&client->dev); > pm_runtime_set_active(&client->dev); > pm_runtime_enable(&client->dev); > pm_runtime_set_autosuspend_delay(&client->dev, 2000); > pm_runtime_use_autosuspend(&client->dev); > pm_runtime_put(&client->dev); > ret = devm_add_action_or_reset(&client->dev, icp10100_pm_disable, > &client->dev); > > > Here, get/put are balanced, but the icp10100_pm_disable logic is: > > static void icp10100_pm_disable(void *data) > { > struct device *dev = data; > > pm_runtime_put_sync_suspend(dev); I'll drop this in v2. Thanks, Jonathan > pm_runtime_disable(dev); > } > > Not sure what RPM get() it is trying to balance there. > > Thanks, > Mauro