Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+3 -1
+3 -1
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
··· 158 158 int tries = 10; 159 159 int ret; 160 160 161 - pm_runtime_get_sync(&client->dev); 161 + ret = pm_runtime_resume_and_get(&client->dev); 162 + if (ret < 0) 163 + return ret; 162 164 163 165 /* start sample */ 164 166 ret = lidar_write_control(data, LIDAR_REG_CONTROL_ACQUIRE);