RE: [PATCH 6/8] media: rzg2l-cru: csi2: Use devm_pm_runtime_enable()

Biju Das
2025-02-10T11:56:21Z

Hi Tommaso Merciai,

> -----Original Message-----
> From: Tommaso Merciai <tomm.merciai@gmail.com>
> Sent: 10 February 2025 11:46
> Subject: [PATCH 6/8] media: rzg2l-cru: csi2: Use devm_pm_runtime_enable()
>
> Use newly added devm_pm_runtime_enable() into rzg2l_csi2_probe() and drop error path accordingly. Drop
> also unnecessary pm_runtime_disable() from rzg2l_csi2_remove().
>
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>

Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>

Cheers,
Biju

> ---
> drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
> b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
> index 948f1917b830..4ccf7c5ea58b 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
> @@ -805,11 +805,13 @@ static int rzg2l_csi2_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - pm_runtime_enable(dev);
> + ret = devm_pm_runtime_enable(dev);
> + if (ret)
> + return ret;
>
> ret = rzg2l_validate_csi2_lanes(csi2);
> if (ret)
> - goto error_pm;
> + return ret;
>
> csi2->subdev.dev = dev;
> v4l2_subdev_init(&csi2->subdev, &rzg2l_csi2_subdev_ops); @@ -834,7 +836,7 @@ static int
> rzg2l_csi2_probe(struct platform_device *pdev)
> ret = media_entity_pads_init(&csi2->subdev.entity, ARRAY_SIZE(csi2->pads),
> csi2->pads);
> if (ret)
> - goto error_pm;
> + return ret;
>
> ret = v4l2_subdev_init_finalize(&csi2->subdev);
> if (ret < 0)
> @@ -852,8 +854,6 @@ static int rzg2l_csi2_probe(struct platform_device *pdev)
> v4l2_async_nf_unregister(&csi2->notifier);
> v4l2_async_nf_cleanup(&csi2->notifier);
> media_entity_cleanup(&csi2->subdev.entity);
> -error_pm:
> - pm_runtime_disable(dev);
>
> return ret;
> }
> @@ -867,7 +867,6 @@ static void rzg2l_csi2_remove(struct platform_device *pdev)
> v4l2_async_unregister_subdev(&csi2->subdev);
> v4l2_subdev_cleanup(&csi2->subdev);
> media_entity_cleanup(&csi2->subdev.entity);
> - pm_runtime_disable(&pdev->dev);
> }
>
> static int rzg2l_csi2_pm_runtime_suspend(struct device *dev)
> --
> 2.34.1