[v2,5/6] drm/mediatek: mtk_dpi: Use devm_platform_ioremap_resource()

Message ID 20230719075056.72178-6-angelogioacchino.delregno@collabora.com
State New
Headers
Series drm/mediatek: Small mtk-dpi cleanups |

Commit Message

AngeloGioacchino Del Regno July 19, 2023, 7:50 a.m. UTC
  Instead of the open-coded platform_get_resource, devm_ioremap_resource
switch to devm_platform_ioremap_resource(), also dropping the useless
struct resource pointer, which becomes unused.

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

Comments

Fei Shao July 19, 2023, 10:25 a.m. UTC | #1
On Wed, Jul 19, 2023 at 3:51 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Instead of the open-coded platform_get_resource, devm_ioremap_resource
> switch to devm_platform_ioremap_resource(), also dropping the useless
> struct resource pointer, which becomes unused.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Reviewed-by: Fei Shao <fshao@chromium.org>
  
CK Hu (胡俊光) July 26, 2023, 5:55 a.m. UTC | #2
Hi, Angelo:

On Wed, 2023-07-19 at 09:50 +0200, AngeloGioacchino Del Regno wrote:
> Instead of the open-coded platform_get_resource,
> devm_ioremap_resource
> switch to devm_platform_ioremap_resource(), also dropping the useless
> struct resource pointer, which becomes unused.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c
> b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 3a140498c98a..244340df7468 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -1007,7 +1007,6 @@ static int mtk_dpi_probe(struct platform_device
> *pdev)
>  {
>  	struct device *dev = &pdev->dev;
>  	struct mtk_dpi *dpi;
> -	struct resource *mem;
>  	int ret;
>  
>  	dpi = devm_kzalloc(dev, sizeof(*dpi), GFP_KERNEL);
> @@ -1038,8 +1037,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_ioremap_resource(pdev, 0);
>  	if (IS_ERR(dpi->regs))
>  		return dev_err_probe(dev, PTR_ERR(dpi->regs),
>  				     "Failed to ioremap mem
> resource\n");
  

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 3a140498c98a..244340df7468 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -1007,7 +1007,6 @@  static int mtk_dpi_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct mtk_dpi *dpi;
-	struct resource *mem;
 	int ret;
 
 	dpi = devm_kzalloc(dev, sizeof(*dpi), GFP_KERNEL);
@@ -1038,8 +1037,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_ioremap_resource(pdev, 0);
 	if (IS_ERR(dpi->regs))
 		return dev_err_probe(dev, PTR_ERR(dpi->regs),
 				     "Failed to ioremap mem resource\n");