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

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
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);

	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_start(ctx);
+5 −3
Original line number Diff line number Diff line
@@ -1024,7 +1024,7 @@ static int cal_probe(struct platform_device *pdev)

	/* Read the revision and hardware info to verify hardware access. */
	pm_runtime_enable(&pdev->dev);
	ret = pm_runtime_get_sync(&pdev->dev);
	ret = pm_runtime_resume_and_get(&pdev->dev);
	if (ret)
		goto error_pm_runtime;

@@ -1098,10 +1098,11 @@ static int cal_remove(struct platform_device *pdev)
{
	struct cal_dev *cal = platform_get_drvdata(pdev);
	unsigned int i;
	int ret;

	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);

@@ -1115,6 +1116,7 @@ static int cal_remove(struct platform_device *pdev)
	for (i = 0; i < cal->data->num_csi2_phy; i++)
		cal_camerarx_destroy(cal->phy[i]);

	if (ret >= 0)
		pm_runtime_put_sync(&pdev->dev);
	pm_runtime_disable(&pdev->dev);

+3 −5
Original line number Diff line number Diff line
@@ -2471,11 +2471,9 @@ static int vpe_runtime_get(struct platform_device *pdev)

	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);
	if (r)
		pm_runtime_put_noidle(&pdev->dev);
	return r < 0 ? r : 0;
	return r;
}

static void vpe_runtime_put(struct platform_device *pdev)
@@ -2580,7 +2578,7 @@ static int vpe_probe(struct platform_device *pdev)
	pm_runtime_enable(&pdev->dev);

	ret = vpe_runtime_get(pdev);
	if (ret)
	if (ret < 0)
		goto rel_m2m;

	/* Perform clk enable followed by reset */