Commit 09dfb36c authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

media: camss: 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.
Reviewed-by: default avatarRobert Foss <robert.foss@linaro.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 97df01fa
......@@ -156,11 +156,9 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)
int ret;
if (on) {
ret = pm_runtime_get_sync(dev);
if (ret < 0) {
pm_runtime_put_sync(dev);
ret = pm_runtime_resume_and_get(dev);
if (ret < 0)
return ret;
}
ret = regulator_enable(csid->vdda);
if (ret < 0) {
......
......@@ -197,11 +197,9 @@ static int csiphy_set_power(struct v4l2_subdev *sd, int on)
if (on) {
int ret;
ret = pm_runtime_get_sync(dev);
if (ret < 0) {
pm_runtime_put_sync(dev);
ret = pm_runtime_resume_and_get(dev);
if (ret < 0)
return ret;
}
ret = csiphy_set_clock_rates(csiphy);
if (ret < 0) {
......
......@@ -372,11 +372,9 @@ static int ispif_set_power(struct v4l2_subdev *sd, int on)
goto exit;
}
ret = pm_runtime_get_sync(dev);
if (ret < 0) {
pm_runtime_put_sync(dev);
ret = pm_runtime_resume_and_get(dev);
if (ret < 0)
goto exit;
}
ret = camss_enable_clocks(ispif->nclocks, ispif->clock, dev);
if (ret < 0) {
......
......@@ -584,9 +584,9 @@ static int vfe_get(struct vfe_device *vfe)
if (ret < 0)
goto error_pm_domain;
ret = pm_runtime_get_sync(vfe->camss->dev);
ret = pm_runtime_resume_and_get(vfe->camss->dev);
if (ret < 0)
goto error_pm_runtime_get;
goto error_domain_off;
ret = vfe_set_clock_rates(vfe);
if (ret < 0)
......@@ -620,6 +620,7 @@ static int vfe_get(struct vfe_device *vfe)
error_pm_runtime_get:
pm_runtime_put_sync(vfe->camss->dev);
error_domain_off:
vfe->ops->pm_domain_off(vfe);
error_pm_domain:
......
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