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

media: i2c: ak7375: use pm_runtime_resume_and_get()

Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter")
added pm_runtime_resume_and_get() in order to automatically handle
dev->power.usage_count decrement on errors.

Use the new API, in order to cleanup the error check logic.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

+1 -9
+1 -9
drivers/media/i2c/ak7375.c
··· 87 87 88 88 static int ak7375_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 89 89 { 90 - int ret; 91 - 92 - ret = pm_runtime_get_sync(sd->dev); 93 - if (ret < 0) { 94 - pm_runtime_put_noidle(sd->dev); 95 - return ret; 96 - } 97 - 98 - return 0; 90 + return pm_runtime_resume_and_get(sd->dev); 99 91 } 100 92 101 93 static int ak7375_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)