diff mbox series

drm/hisilicon: Use devm_platform_get_and_ioremap_resource() in dsi_parse_dt()

Message ID b236236a-9953-4246-a697-19ed1b22d86a@web.de (mailing list archive)
State New, archived
Headers show
Series drm/hisilicon: Use devm_platform_get_and_ioremap_resource() in dsi_parse_dt() | expand

Commit Message

Markus Elfring Feb. 5, 2024, 8:12 a.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
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@users.sourceforge.net>
---
 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--
2.43.0

Comments

John Stultz Feb. 5, 2024, 5:55 p.m. UTC | #1
On Mon, Feb 5, 2024 at 12:13 AM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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@users.sourceforge.net>

I no longer have hardware to test with this, but this looks reasonable to me.

Acked-by: John Stultz <jstultz@google.com>

thanks
-john
Doug Anderson Feb. 5, 2024, 6:11 p.m. UTC | #2
Hi,

On Mon, Feb 5, 2024 at 12:13 AM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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@users.sourceforge.net>
> ---
>  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@chromium.org>
diff mbox series

Patch

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