mbox series

[00/14] drm: Move to using devm_platform_ioremap_resource

Message ID 20250128-cocci-memory-api-v1-0-0d1609a29587@redhat.com (mailing list archive)
Headers show
Series drm: Move to using devm_platform_ioremap_resource | expand

Message

Anusha Srivatsa Jan. 28, 2025, 10:29 p.m. UTC
Start replacing the below occurences with the newer API:
- (devm_)platform_get_resource + devm_ioremap_resource
- (devm_)platform_get_resource + (devm_)ioremap
- platform_get_resource_byname + devm_ioremap
Move all these occurences to uses devm_platform_ioremap_resource
instead.

Address a TODO item in the GPU section.

Used Coccinelle to make the code changes.Semantic patch:

//First Case
//rule s/platform_get_resource + devm_ioremap_resource/devm_platform_ioremap_resource
@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);

//Second case
//rule s/(devm_)platform_get_resource + (devm_)ioremap/devm_platform_ioremap_resource.
@rule_2@
identifier res;
expression ioremap;
identifier pdev;
@@
-struct resource *res;
...
-res = platform_get_resource(pdev,...);
<...
-if (!res) {
-...
-}
...>
-ioremap = devm_ioremap(...);
+ioremap = devm_platform_ioremap_resource(pdev,0);

//Third case
//rule s/(devm_)platform_get_resource_byname + (devm_)ioremap/devm_platform_ioremap_resource_byname.
@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);

Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
Anusha Srivatsa (14):
      drm/aspeed: move to devm_platform_ioremap_resource() usage
      drm/fsl-dcu: move to devm_platform_ioremap_resource() usage
      drm/hisilicon: move to devm_platform_ioremap_resource() usage
      drm/mediatek: move to devm_platform_ioremap_resource() usage
      drm/meson: move to devm_platform_ioremap_resource() usage
      drm/mxsfb: move to devm_platform_ioremap_resource() usage
      drm/rockchip: move to devm_platform_ioremap_resource() usage
      drm/sprd: move to devm_platform_ioremap_resource() usage
      drm/sti: move to devm_platform_ioremap_resource() usage
      drm/stm: move to devm_platform_ioremap_resource() usage
      drm/tegra: move to devm_platform_ioremap_resource() usage
      drm/tiny: move to devm_platform_ioremap_resource() usage
      drm/vc4: move to devm_platform_ioremap_resource() usage
      Documentation: Update the todo

 Documentation/gpu/todo.rst                      | 15 ---------------
 drivers/gpu/drm/aspeed/aspeed_gfx_drv.c         |  4 +---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       |  4 +---
 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c    |  4 +---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c |  4 +---
 drivers/gpu/drm/mediatek/mtk_disp_color.c       |  4 +---
 drivers/gpu/drm/mediatek/mtk_disp_gamma.c       |  4 +---
 drivers/gpu/drm/mediatek/mtk_disp_merge.c       |  4 +---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c         |  4 +---
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c        |  4 +---
 drivers/gpu/drm/mediatek/mtk_dsi.c              |  4 +---
 drivers/gpu/drm/mediatek/mtk_hdmi.c             |  4 +---
 drivers/gpu/drm/mediatek/mtk_mdp_rdma.c         |  4 +---
 drivers/gpu/drm/meson/meson_drv.c               |  9 +--------
 drivers/gpu/drm/mxsfb/lcdif_drv.c               |  4 +---
 drivers/gpu/drm/mxsfb/mxsfb_drv.c               |  4 +---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c     |  4 +---
 drivers/gpu/drm/sprd/sprd_dpu.c                 |  9 +--------
 drivers/gpu/drm/sprd/sprd_dsi.c                 |  9 +--------
 drivers/gpu/drm/sti/sti_compositor.c            | 10 +---------
 drivers/gpu/drm/sti/sti_dvo.c                   | 10 +---------
 drivers/gpu/drm/sti/sti_hda.c                   | 10 +---------
 drivers/gpu/drm/sti/sti_hdmi.c                  | 11 +----------
 drivers/gpu/drm/sti/sti_hqvdp.c                 | 10 +---------
 drivers/gpu/drm/sti/sti_tvout.c                 | 10 +---------
 drivers/gpu/drm/sti/sti_vtg.c                   | 10 +---------
 drivers/gpu/drm/stm/ltdc.c                      |  4 +---
 drivers/gpu/drm/tegra/dsi.c                     |  4 +---
 drivers/gpu/drm/tiny/arcpgu.c                   |  4 +---
 drivers/gpu/drm/vc4/vc4_hdmi.c                  |  9 ++-------
 30 files changed, 30 insertions(+), 164 deletions(-)
---
base-commit: c4b9570cfb63501638db720f3bee9f6dfd044b82
change-id: 20250128-cocci-memory-api-266e13a057e7

Best regards,