提交 a959a7bf 编写于 作者: M Mauro Carvalho Chehab

media: i2c: video-i2c: use pm_runtime_resume_and_get()

Commit dd8088d5 ("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.
Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
上级 81f2fe55
...@@ -286,11 +286,9 @@ static int amg88xx_read(struct device *dev, enum hwmon_sensor_types type, ...@@ -286,11 +286,9 @@ static int amg88xx_read(struct device *dev, enum hwmon_sensor_types type,
__le16 buf; __le16 buf;
int tmp; int tmp;
tmp = pm_runtime_get_sync(regmap_get_device(data->regmap)); tmp = pm_runtime_resume_and_get(regmap_get_device(data->regmap));
if (tmp < 0) { if (tmp < 0)
pm_runtime_put_noidle(regmap_get_device(data->regmap));
return tmp; return tmp;
}
tmp = regmap_bulk_read(data->regmap, AMG88XX_REG_TTHL, &buf, 2); tmp = regmap_bulk_read(data->regmap, AMG88XX_REG_TTHL, &buf, 2);
pm_runtime_mark_last_busy(regmap_get_device(data->regmap)); pm_runtime_mark_last_busy(regmap_get_device(data->regmap));
...@@ -512,11 +510,9 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) ...@@ -512,11 +510,9 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count)
if (data->kthread_vid_cap) if (data->kthread_vid_cap)
return 0; return 0;
ret = pm_runtime_get_sync(dev); ret = pm_runtime_resume_and_get(dev);
if (ret < 0) { if (ret < 0)
pm_runtime_put_noidle(dev);
goto error_del_list; goto error_del_list;
}
ret = data->chip->setup(data); ret = data->chip->setup(data);
if (ret) if (ret)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册