Re: [PATCH] drm/hisilicon: Use devm_platform_get_and_ioremap_resource() in dsi_parse_dt()

From: Doug Anderson
Date: Mon Feb 05 2024 - 13:11:37 EST


Hi,

On Mon, Feb 5, 2024 at 12:13 AM Markus Elfring <Markus.Elfring@xxxxxx> wrote:
>
> From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> Date: Mon, 5 Feb 2024 08:58:21 +0100
>
> A wrapper function is available since the commit 890cc39a879906b63912482dfc41944579df2dc6
> ("drivers: provide devm_platform_get_and_ioremap_resource()").
> Thus reuse existing functionality instead of keeping duplicate source code.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> ---
> drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
> index 566de4658719..1edf429c49d7 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
> @@ -834,8 +834,7 @@ static int dsi_parse_dt(struct platform_device *pdev, struct dw_dsi *dsi)
> return PTR_ERR(ctx->pclk);
> }
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - ctx->base = devm_ioremap_resource(&pdev->dev, res);
> + ctx->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> if (IS_ERR(ctx->base)) {
> DRM_ERROR("failed to remap dsi io region\n");
> return PTR_ERR(ctx->base);

This function no longer needs the local variable "res". Remove it and
then change the function call to devm_platform_ioremap_resource().
With that:

Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>