media: camss: use pm_runtime_resume_and_get()

Commit dd8088d5a8 ("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: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Mauro Carvalho Chehab
2021-04-23 17:19:18 +02:00
parent 97df01fae8
commit 09dfb36ce2
4 changed files with 9 additions and 14 deletions

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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 @@ error_reset:
error_pm_runtime_get:
pm_runtime_put_sync(vfe->camss->dev);
error_domain_off:
vfe->ops->pm_domain_off(vfe);
error_pm_domain: