[PATCH 1/3] drm/mediatek: Use devm_platform_get_and_ioremap_resource()

CK Hu (胡俊光) ck.hu at mediatek.com
Mon Jul 3 23:28:29 PDT 2023


Hi, Angelo:

On Thu, 2023-06-08 at 12:12 +0200, AngeloGioacchino Del Regno wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  Instead of open coding calls to platform_get_resource() followed by
> devm_ioremap_resource(), perform a single call to the helper
> devm_platform_get_and_ioremap_resource().
> 
> This commit brings no functional changes.
> 
> Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno at collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_cec.c        | 3 +--
>  drivers/gpu/drm/mediatek/mtk_disp_aal.c   | 3 +--
>  drivers/gpu/drm/mediatek/mtk_disp_ccorr.c | 3 +--
>  drivers/gpu/drm/mediatek/mtk_disp_color.c | 3 +--
>  drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 3 +--
>  drivers/gpu/drm/mediatek/mtk_disp_merge.c | 3 +--
>  drivers/gpu/drm/mediatek/mtk_disp_ovl.c   | 3 +--
>  drivers/gpu/drm/mediatek/mtk_disp_rdma.c  | 3 +--
>  drivers/gpu/drm/mediatek/mtk_dsi.c        | 3 +--
>  drivers/gpu/drm/mediatek/mtk_hdmi.c       | 3 +--
>  drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c   | 3 +--
>  drivers/gpu/drm/mediatek/mtk_mdp_rdma.c   | 3 +--
>  12 files changed, 12 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_cec.c
> b/drivers/gpu/drm/mediatek/mtk_cec.c
> index b640bc0559e7..5136aada9023 100644
> --- a/drivers/gpu/drm/mediatek/mtk_cec.c
> +++ b/drivers/gpu/drm/mediatek/mtk_cec.c
> @@ -195,8 +195,7 @@ static int mtk_cec_probe(struct platform_device
> *pdev)
>  	platform_set_drvdata(pdev, cec);
>  	spin_lock_init(&cec->lock);
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	cec->regs = devm_ioremap_resource(dev, res);
> +	cec->regs = devm_platform_get_and_ioremap_resource(pdev, 0,
> &res);

The 'res' is useless, so drop it.

Regards,
CK

>  	if (IS_ERR(cec->regs)) {
>  		ret = PTR_ERR(cec->regs);
>  		dev_err(dev, "Failed to ioremap cec: %d\n", ret);
> 


More information about the linux-arm-kernel mailing list