[PATCH 05/14] drm/meson: move to devm_platform_ioremap_resource() usage
Anusha Srivatsa
asrivats at redhat.com
Tue Jan 28 14:29:29 PST 2025
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");
if (!regs) {
ret = -EADDRNOTAVAIL;
goto free_drm;
--
2.47.0
More information about the Linux-mediatek
mailing list