Message ID | 20210509113354.660190-26-jic23@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | IIO: Runtime PM related cleanups. | expand |
Em Sun, 9 May 2021 12:33:51 +0100 Jonathan Cameron <jic23@kernel.org> escreveu: > From: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > Previously this driver used pm_runtime_sync_get() and did not handle any > errors that occurred. Moving to the new pm_runtime_resume_and_get() + > handle errors. > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > Cc: Andreas Klinger <ak@it-klinger.de> LGTM. Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> > --- > drivers/iio/proximity/srf04.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/iio/proximity/srf04.c b/drivers/iio/proximity/srf04.c > index 420c37c72de4..fe88b2bb60bc 100644 > --- a/drivers/iio/proximity/srf04.c > +++ b/drivers/iio/proximity/srf04.c > @@ -100,9 +100,11 @@ static int srf04_read(struct srf04_data *data) > u64 dt_ns; > u32 time_ns, distance_mm; > > - if (data->gpiod_power) > - pm_runtime_get_sync(data->dev); > - > + if (data->gpiod_power) { > + ret = pm_runtime_resume_and_get(data->dev); > + if (ret < 0) > + return ret; > + } > /* > * just one read-echo-cycle can take place at a time > * ==> lock against concurrent reading calls Thanks, Mauro
On Wed, 12 May 2021 16:53:26 +0200 Mauro Carvalho Chehab <mchehab@kernel.org> wrote: > Em Sun, 9 May 2021 12:33:51 +0100 > Jonathan Cameron <jic23@kernel.org> escreveu: > > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > > > Previously this driver used pm_runtime_sync_get() and did not handle any > > errors that occurred. Moving to the new pm_runtime_resume_and_get() + > > handle errors. > > > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > Cc: Andreas Klinger <ak@it-klinger.de> > > LGTM. > > Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to see if we missed anything. Thanks, Jonathan > > > --- > > drivers/iio/proximity/srf04.c | 8 +++++--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/iio/proximity/srf04.c b/drivers/iio/proximity/srf04.c > > index 420c37c72de4..fe88b2bb60bc 100644 > > --- a/drivers/iio/proximity/srf04.c > > +++ b/drivers/iio/proximity/srf04.c > > @@ -100,9 +100,11 @@ static int srf04_read(struct srf04_data *data) > > u64 dt_ns; > > u32 time_ns, distance_mm; > > > > - if (data->gpiod_power) > > - pm_runtime_get_sync(data->dev); > > - > > + if (data->gpiod_power) { > > + ret = pm_runtime_resume_and_get(data->dev); > > + if (ret < 0) > > + return ret; > > + } > > /* > > * just one read-echo-cycle can take place at a time > > * ==> lock against concurrent reading calls > > > > Thanks, > Mauro
diff --git a/drivers/iio/proximity/srf04.c b/drivers/iio/proximity/srf04.c index 420c37c72de4..fe88b2bb60bc 100644 --- a/drivers/iio/proximity/srf04.c +++ b/drivers/iio/proximity/srf04.c @@ -100,9 +100,11 @@ static int srf04_read(struct srf04_data *data) u64 dt_ns; u32 time_ns, distance_mm; - if (data->gpiod_power) - pm_runtime_get_sync(data->dev); - + if (data->gpiod_power) { + ret = pm_runtime_resume_and_get(data->dev); + if (ret < 0) + return ret; + } /* * just one read-echo-cycle can take place at a time * ==> lock against concurrent reading calls