[PATCH 05/14] drm/meson: move to devm_platform_ioremap_resource() usage
Maxime Ripard
mripard at kernel.org
Wed Jan 29 07:40:41 PST 2025
On Tue, Jan 28, 2025 at 05:29:29PM -0500, Anusha Srivatsa wrote:
> Replace platform_get_resource_byname + devm_ioremap
> with just devm_platform_ioremap_resource()
>
> Used Coccinelle to do this change. SmPl patch:
> @rule_3@
> identifier res;
> expression ioremap;
> identifier pdev;
> constant mem;
> expression name;
> @@
> -struct resource *res;
> ...
> -res = platform_get_resource_byname(pdev,mem,name);
> <...
> -if (!res) {
> -...
> -}
> ...>
> -ioremap = devm_ioremap(...);
> +ioremap = devm_platform_ioremap_resource_byname(pdev,name);
>
> Cc: Neil Armstrong <neil.armstrong at linaro.org>
> Signed-off-by: Anusha Srivatsa <asrivats at redhat.com>
> ---
> drivers/gpu/drm/meson/meson_drv.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 81d2ee37e7732dca89d02347b9c972300b38771a..6c805805b7a7f675f8bb03944318972eb4df864e 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -184,7 +184,6 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
> const struct meson_drm_match_data *match;
> struct meson_drm *priv;
> struct drm_device *drm;
> - struct resource *res;
> void __iomem *regs;
> int ret, i;
>
> @@ -220,14 +219,8 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
> }
>
> priv->io_base = regs;
> -
> - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hhi");
> - if (!res) {
> - ret = -EINVAL;
> - goto free_drm;
> - }
> /* Simply ioremap since it may be a shared register zone */
> - regs = devm_ioremap(dev, res->start, resource_size(res));
> + regs = devm_platform_ioremap_resource_byname(pdev, "hhi");
Given the comment, this one should probably be skipped.
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-rockchip/attachments/20250129/a7e16841/attachment.sig>
More information about the Linux-rockchip
mailing list