aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/proximity
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2021-05-16 17:21:02 +0100
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2021-06-16 14:53:13 +0100
commitc2f89f4ccd7a155af2739300de712b8f96aa76a3 (patch)
tree977bdeb3616b3a3325a85064f093a58d9da340ad /drivers/iio/proximity
parentiio: chemical: atlas-sensor: Balance runtime pm + pm_runtime_resume_and_get() (diff)
downloadlinux-dev-c2f89f4ccd7a155af2739300de712b8f96aa76a3.tar.xz
linux-dev-c2f89f4ccd7a155af2739300de712b8f96aa76a3.zip
iio: prox: pulsed-light-v2: Use pm_runtime_resume_and_get()
Using this new call makes it easy to handle any errors as a result of runtime resume as it exits without leaving the reference count elevated. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Matt Ranostay <matt.ranostay@konsulko.com> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com> Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/20210516162103.1332291-6-jic23@kernel.org
Diffstat (limited to 'drivers/iio/proximity')
-rw-r--r--drivers/iio/proximity/pulsedlight-lidar-lite-v2.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
index d854b8d5fbba..27026c060ab9 100644
--- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
+++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
@@ -158,7 +158,9 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
int tries = 10;
int ret;
- pm_runtime_get_sync(&client->dev);
+ ret = pm_runtime_resume_and_get(&client->dev);
+ if (ret < 0)
+ return ret;
/* start sample */
ret = lidar_write_control(data, LIDAR_REG_CONTROL_ACQUIRE);