mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v5 0/7] drm: Move to using devm_platform_ioremap_resource
@ 2025-03-04 21:05 Anusha Srivatsa
  2025-03-04 21:05 ` [PATCH v5 1/7] drm/fsl-dcu: move to devm_platform_ioremap_resource() usage Anusha Srivatsa
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Anusha Srivatsa @ 2025-03-04 21:05 UTC (permalink / raw)
  To: Stefan Agner, Alison Wang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Xinliang Liu,
	Tian Tao, Xinwei Kong, Sumit Semwal, Yongqin Liu, John Stultz,
	Marek Vasut, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Alain Volmat, Raphael Gallais-Pou, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Jonathan Corbet
  Cc: Dan Carpenter, dri-devel, linux-kernel, imx, linux-arm-kernel,
	linux-tegra, linux-doc, Anusha Srivatsa, Dmitry Baryshkov,
	Raphael Gallais-Pou

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.

This is v5 of the series.

Changes in v5:
- Some patches already merged, leave them out.
- Handle return properly. The new API returns a error pointers
and not NULL. While this is taken care of in most drivers in
the series, the sprd and sti needed changes. Thanks to Dan
for pointing this out with his fix:
https://lore.kernel.org/dri-devel/a952e2b4-d4b8-49ac-abd9-9967c50f4a80@stanley.mountain/

Changes in v4:
- Address vc4 driver compilation error

Changes in v3:
- Keep the old snippet of documentation and add further
clarification (Thomas)
- change in vc4 driver for the a resource is not needed.
Add a comment to clarify why that is left behind (Maxime)

Changes in v2:
- Fix compilation errors

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 (7):
      drm/fsl-dcu: move to devm_platform_ioremap_resource() usage
      drm/hisilicon: move to devm_platform_ioremap_resource() usage
      drm/mxsfb: 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/tegra: move to devm_platform_ioremap_resource() usage
      Documentation: Update the todo

 Documentation/gpu/todo.rst                      | 13 +++++++------
 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/mxsfb/lcdif_drv.c               |  4 +---
 drivers/gpu/drm/mxsfb/mxsfb_drv.c               |  4 +---
 drivers/gpu/drm/sprd/sprd_dpu.c                 | 13 +++----------
 drivers/gpu/drm/sprd/sprd_dsi.c                 | 13 +++----------
 drivers/gpu/drm/sti/sti_compositor.c            | 14 +++-----------
 drivers/gpu/drm/sti/sti_dvo.c                   | 14 +++-----------
 drivers/gpu/drm/sti/sti_hda.c                   | 13 +++----------
 drivers/gpu/drm/sti/sti_hdmi.c                  | 15 +++------------
 drivers/gpu/drm/sti/sti_hqvdp.c                 | 14 +++-----------
 drivers/gpu/drm/sti/sti_tvout.c                 | 14 +++-----------
 drivers/gpu/drm/sti/sti_vtg.c                   | 14 +++-----------
 drivers/gpu/drm/tegra/dsi.c                     |  4 +---
 16 files changed, 40 insertions(+), 121 deletions(-)
---
base-commit: 0670c2f56e45b3f4541985a9ebe06d04308e43b0
change-id: 20250304-mem-fixes-34df71d18b98

Best regards,
-- 
Anusha Srivatsa <asrivats@redhat.com>


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-03-04 21:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-04 21:05 [PATCH v5 0/7] drm: Move to using devm_platform_ioremap_resource Anusha Srivatsa
2025-03-04 21:05 ` [PATCH v5 1/7] drm/fsl-dcu: move to devm_platform_ioremap_resource() usage Anusha Srivatsa
2025-03-04 21:05 ` [PATCH v5 2/7] drm/hisilicon: " Anusha Srivatsa
2025-03-04 21:05 ` [PATCH v5 3/7] drm/mxsfb: " Anusha Srivatsa
2025-03-04 21:05 ` [PATCH v5 4/7] drm/sprd: " Anusha Srivatsa
2025-03-04 21:05 ` [PATCH v5 5/7] drm/sti: " Anusha Srivatsa
2025-03-04 21:05 ` [PATCH v5 6/7] drm/tegra: " Anusha Srivatsa
2025-03-04 21:05 ` [PATCH v5 7/7] Documentation: Update the todo Anusha Srivatsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®