Commit 588bc430 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

media: ti-vpe: 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: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 79e790ff
...@@ -700,7 +700,9 @@ static int cal_start_streaming(struct vb2_queue *vq, unsigned int count) ...@@ -700,7 +700,9 @@ static int cal_start_streaming(struct vb2_queue *vq, unsigned int count)
addr = vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 0); addr = vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 0);
pm_runtime_get_sync(ctx->cal->dev); ret = pm_runtime_resume_and_get(ctx->cal->dev);
if (ret < 0)
goto error_pipeline;
cal_ctx_set_dma_addr(ctx, addr); cal_ctx_set_dma_addr(ctx, addr);
cal_ctx_start(ctx); cal_ctx_start(ctx);
......
...@@ -1024,7 +1024,7 @@ static int cal_probe(struct platform_device *pdev) ...@@ -1024,7 +1024,7 @@ static int cal_probe(struct platform_device *pdev)
/* Read the revision and hardware info to verify hardware access. */ /* Read the revision and hardware info to verify hardware access. */
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
ret = pm_runtime_get_sync(&pdev->dev); ret = pm_runtime_resume_and_get(&pdev->dev);
if (ret) if (ret)
goto error_pm_runtime; goto error_pm_runtime;
...@@ -1098,10 +1098,11 @@ static int cal_remove(struct platform_device *pdev) ...@@ -1098,10 +1098,11 @@ static int cal_remove(struct platform_device *pdev)
{ {
struct cal_dev *cal = platform_get_drvdata(pdev); struct cal_dev *cal = platform_get_drvdata(pdev);
unsigned int i; unsigned int i;
int ret;
cal_dbg(1, cal, "Removing %s\n", CAL_MODULE_NAME); cal_dbg(1, cal, "Removing %s\n", CAL_MODULE_NAME);
pm_runtime_get_sync(&pdev->dev); ret = pm_runtime_resume_and_get(&pdev->dev);
cal_media_unregister(cal); cal_media_unregister(cal);
...@@ -1115,6 +1116,7 @@ static int cal_remove(struct platform_device *pdev) ...@@ -1115,6 +1116,7 @@ static int cal_remove(struct platform_device *pdev)
for (i = 0; i < cal->data->num_csi2_phy; i++) for (i = 0; i < cal->data->num_csi2_phy; i++)
cal_camerarx_destroy(cal->phy[i]); cal_camerarx_destroy(cal->phy[i]);
if (ret >= 0)
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
......
...@@ -2471,11 +2471,9 @@ static int vpe_runtime_get(struct platform_device *pdev) ...@@ -2471,11 +2471,9 @@ static int vpe_runtime_get(struct platform_device *pdev)
dev_dbg(&pdev->dev, "vpe_runtime_get\n"); dev_dbg(&pdev->dev, "vpe_runtime_get\n");
r = pm_runtime_get_sync(&pdev->dev); r = pm_runtime_resume_and_get(&pdev->dev);
WARN_ON(r < 0); WARN_ON(r < 0);
if (r) return r;
pm_runtime_put_noidle(&pdev->dev);
return r < 0 ? r : 0;
} }
static void vpe_runtime_put(struct platform_device *pdev) static void vpe_runtime_put(struct platform_device *pdev)
...@@ -2580,7 +2578,7 @@ static int vpe_probe(struct platform_device *pdev) ...@@ -2580,7 +2578,7 @@ static int vpe_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
ret = vpe_runtime_get(pdev); ret = vpe_runtime_get(pdev);
if (ret) if (ret < 0)
goto rel_m2m; goto rel_m2m;
/* Perform clk enable followed by reset */ /* Perform clk enable followed by reset */
......
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