diff mbox series

[4/4] drm/mediatek: mtk_dpi: Use devm_platform_get_and_ioremap_resource()

Message ID 20230412115250.164899-5-angelogioacchino.delregno@collabora.com (mailing list archive)
State New, archived
Headers show
Series drm/mediatek: Small mtk-dpi cleanups | expand

Commit Message

AngeloGioacchino Del Regno April 12, 2023, 11:52 a.m. UTC
Instead of the open-coded platform_get_resource, devm_ioremap_resource
switch to devm_platform_get_and_ioremap_resource(), doing exactly the
same.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_dpi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Fei Shao July 13, 2023, 8:34 a.m. UTC | #1
Hi Angelo,

On Wed, Apr 12, 2023 at 7:53 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Instead of the open-coded platform_get_resource, devm_ioremap_resource
> switch to devm_platform_get_and_ioremap_resource(), doing exactly the
> same.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 9025111013d3..45535dc7970f 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -1038,8 +1038,7 @@ static int mtk_dpi_probe(struct platform_device *pdev)
>                         dev_dbg(&pdev->dev, "Cannot find pinctrl active!\n");
>                 }
>         }
> -       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -       dpi->regs = devm_ioremap_resource(dev, mem);
> +       dpi->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &mem);

"mem" appears to be unused elsewhere, so I assume
devm_platform_ioremap_resource() would be a better fit.

Regards,
Fei

>         if (IS_ERR(dpi->regs))
>                 return dev_err_probe(dev, PTR_ERR(dpi->regs),
>                                      "Failed to ioremap mem resource\n");
> --
> 2.40.0
>
>
AngeloGioacchino Del Regno July 13, 2023, 11:14 a.m. UTC | #2
Il 13/07/23 10:34, Fei Shao ha scritto:
> Hi Angelo,
> 
> On Wed, Apr 12, 2023 at 7:53 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com> wrote:
>>
>> Instead of the open-coded platform_get_resource, devm_ioremap_resource
>> switch to devm_platform_get_and_ioremap_resource(), doing exactly the
>> same.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>>   drivers/gpu/drm/mediatek/mtk_dpi.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
>> index 9025111013d3..45535dc7970f 100644
>> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
>> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
>> @@ -1038,8 +1038,7 @@ static int mtk_dpi_probe(struct platform_device *pdev)
>>                          dev_dbg(&pdev->dev, "Cannot find pinctrl active!\n");
>>                  }
>>          }
>> -       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> -       dpi->regs = devm_ioremap_resource(dev, mem);
>> +       dpi->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &mem);
> 
> "mem" appears to be unused elsewhere, so I assume
> devm_platform_ioremap_resource() would be a better fit.
> 

That's right. I'll switch to devm_platform_ioremap_resource() in v2.

Cheers,
Angelo

> Regards,
> Fei
> 
>>          if (IS_ERR(dpi->regs))
>>                  return dev_err_probe(dev, PTR_ERR(dpi->regs),
>>                                       "Failed to ioremap mem resource\n");
>> --
>> 2.40.0
>>
>>
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 9025111013d3..45535dc7970f 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -1038,8 +1038,7 @@  static int mtk_dpi_probe(struct platform_device *pdev)
 			dev_dbg(&pdev->dev, "Cannot find pinctrl active!\n");
 		}
 	}
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	dpi->regs = devm_ioremap_resource(dev, mem);
+	dpi->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &mem);
 	if (IS_ERR(dpi->regs))
 		return dev_err_probe(dev, PTR_ERR(dpi->regs),
 				     "Failed to ioremap mem resource\n");