[PATCH 07/14] drm/rockchip: move to devm_platform_ioremap_resource() usage

Maxime Ripard mripard at kernel.org
Wed Jan 29 07:41:45 PST 2025


On Tue, Jan 28, 2025 at 05:29:31PM -0500, Anusha Srivatsa wrote:
> Replace platform_get_resource + devm_ioremap_resource
> with just devm_platform_ioremap_resource()
> 
> Used Coccinelle to do this change. SmPl patch:
> @rule_1@
> identifier res;
> expression ioremap_res;
> identifier pdev;
> @@
> -struct resource *res;
> ...
> -res = platform_get_resource(pdev,...);
> -ioremap_res = devm_ioremap_resource(...);
> +ioremap_res = devm_platform_ioremap_resource(pdev,0);
> 
> Cc: Sandy Huang <hjc at rock-chips.com>
> Cc: Heiko Stübner <heiko at sntech.de>
> Cc: Andy Yan <andy.yan at rock-chips.com>
> Signed-off-by: Anusha Srivatsa <asrivats at redhat.com>
> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 57747f1cff26e444ef3569983d6a7f7922f03ff7..4c639f7c868907fc35ce22f2ef7e281ad85c2d9e 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -2187,7 +2187,6 @@ static int vop_bind(struct device *dev, struct device *master, void *data)
>  	const struct vop_data *vop_data;
>  	struct drm_device *drm_dev = data;
>  	struct vop *vop;
> -	struct resource *res;
>  	int ret, irq;
>  
>  	vop_data = of_device_get_match_data(dev);
> @@ -2207,8 +2206,7 @@ static int vop_bind(struct device *dev, struct device *master, void *data)
>  
>  	vop_win_init(vop);
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	vop->regs = devm_ioremap_resource(dev, res);
> +	vop->regs = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(vop->regs))
>  		return PTR_ERR(vop->regs);
>  	vop->len = resource_size(res);

This one will result in a compile failure too, you removed res but it's
still used on the last line.

Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20250129/49156edc/attachment.sig>


More information about the Linux-mediatek mailing list