diff options
author | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-05-09 12:33:51 +0100 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-05-17 13:54:27 +0100 |
commit | 9009a732a87fd6598a5791e0cc4fd2f7d2d602c5 (patch) | |
tree | a9958f21f1bf16d5b811e3ac668feadaac468d6e /drivers/iio/proximity | |
parent | db9c6c2ec4a8789e2445d4a861dfce6d66b10df9 (diff) | |
download | lwn-9009a732a87fd6598a5791e0cc4fd2f7d2d602c5.tar.gz lwn-9009a732a87fd6598a5791e0cc4fd2f7d2d602c5.zip |
iio: proximity: srf04: Use pm_runtime_resume_and_get() and handle error
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>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/20210509113354.660190-26-jic23@kernel.org
Diffstat (limited to 'drivers/iio/proximity')
-rw-r--r-- | drivers/iio/proximity/srf04.c | 8 |
1 files 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 |