drm/vc4: move to devm_platform_ioremap_resource() usage
Replace platform_get_resource_byname + devm_ioremap_resource
with just devm_platform_ioremap_resource()
Used Coccinelle to do this change. SmPl patch:
//rule s/(devm_)platform_get_resource_byname +
//(devm_)ioremap/devm_platform_ioremap_resource.
@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);
...+>
v2: Change the SmPl patch to work on multiple occurences of
the pattern. This also fixes the compilation error.
v3: Do not convert "hd" resource to follow the rest of the
refactor. (Maxime)
v4: fix compiler error
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Dave Stevenson <dave.stevenson@raspberrypi.com>
Cc: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
Link: https://lore.kernel.org/r/20250225-memory-drm-misc-next-v1-11-9d0e8761107a@redhat.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
pull/1188/head
parent
41cb3e2150
commit
b93f07cf09
|
|
@ -2926,15 +2926,16 @@ static int vc5_hdmi_init_resources(struct drm_device *drm,
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hdmi");
|
vc4_hdmi->hdmicore_regs = devm_platform_ioremap_resource_byname(pdev,
|
||||||
if (!res)
|
"hdmi");
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
vc4_hdmi->hdmicore_regs = devm_ioremap(dev, res->start,
|
|
||||||
resource_size(res));
|
|
||||||
if (!vc4_hdmi->hdmicore_regs)
|
if (!vc4_hdmi->hdmicore_regs)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
/* This is shared between both HDMI controllers. Cannot
|
||||||
|
* claim for both instances. Lets not convert to using
|
||||||
|
* devm_platform_ioremap_resource_byname() like
|
||||||
|
* the rest
|
||||||
|
*/
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hd");
|
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hd");
|
||||||
if (!res)
|
if (!res)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
@ -2943,51 +2944,33 @@ static int vc5_hdmi_init_resources(struct drm_device *drm,
|
||||||
if (!vc4_hdmi->hd_regs)
|
if (!vc4_hdmi->hd_regs)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cec");
|
vc4_hdmi->cec_regs = devm_platform_ioremap_resource_byname(pdev,
|
||||||
if (!res)
|
"cec");
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
vc4_hdmi->cec_regs = devm_ioremap(dev, res->start, resource_size(res));
|
|
||||||
if (!vc4_hdmi->cec_regs)
|
if (!vc4_hdmi->cec_regs)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "csc");
|
vc4_hdmi->csc_regs = devm_platform_ioremap_resource_byname(pdev,
|
||||||
if (!res)
|
"csc");
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
vc4_hdmi->csc_regs = devm_ioremap(dev, res->start, resource_size(res));
|
|
||||||
if (!vc4_hdmi->csc_regs)
|
if (!vc4_hdmi->csc_regs)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dvp");
|
vc4_hdmi->dvp_regs = devm_platform_ioremap_resource_byname(pdev,
|
||||||
if (!res)
|
"dvp");
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
vc4_hdmi->dvp_regs = devm_ioremap(dev, res->start, resource_size(res));
|
|
||||||
if (!vc4_hdmi->dvp_regs)
|
if (!vc4_hdmi->dvp_regs)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy");
|
vc4_hdmi->phy_regs = devm_platform_ioremap_resource_byname(pdev,
|
||||||
if (!res)
|
"phy");
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
vc4_hdmi->phy_regs = devm_ioremap(dev, res->start, resource_size(res));
|
|
||||||
if (!vc4_hdmi->phy_regs)
|
if (!vc4_hdmi->phy_regs)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "packet");
|
vc4_hdmi->ram_regs = devm_platform_ioremap_resource_byname(pdev,
|
||||||
if (!res)
|
"packet");
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
vc4_hdmi->ram_regs = devm_ioremap(dev, res->start, resource_size(res));
|
|
||||||
if (!vc4_hdmi->ram_regs)
|
if (!vc4_hdmi->ram_regs)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rm");
|
vc4_hdmi->rm_regs = devm_platform_ioremap_resource_byname(pdev, "rm");
|
||||||
if (!res)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
vc4_hdmi->rm_regs = devm_ioremap(dev, res->start, resource_size(res));
|
|
||||||
if (!vc4_hdmi->rm_regs)
|
if (!vc4_hdmi->rm_regs)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue