Commit c2f89f4c authored by Jonathan Cameron's avatar Jonathan Cameron

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: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
Acked-by: default avatarMatt Ranostay <matt.ranostay@konsulko.com>
Reviewed-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/20210516162103.1332291-6-jic23@kernel.org
parent 0e4f336f
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment