linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 00/12] drm: Move to using devm_platform_ioremap_resource
@ 2025-02-25 22:20 Anusha Srivatsa
  2025-02-25 22:20 ` [PATCH RESEND 01/12] drm/aspeed: move to devm_platform_ioremap_resource() usage Anusha Srivatsa
                   ` (11 more replies)
  0 siblings, 12 replies; 24+ messages in thread
From: Anusha Srivatsa @ 2025-02-25 22:20 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Alain Volmat,
	Raphael Gallais-Pou, Yannick Fertre, Raphael Gallais-Pou,
	Philippe Cornu, Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc,
	Anusha Srivatsa, CK Hu, Dmitry Baryshkov

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 a resend of v3 of the series. Sending this from drm-misc-next.
Changes from v2 [1]:
- 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)

[1] - https://patchwork.freedesktop.org/series/144073/

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 (12):
      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/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/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                      | 13 +++---
 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/mxsfb/lcdif_drv.c               |  4 +-
 drivers/gpu/drm/mxsfb/mxsfb_drv.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                   |  9 +----
 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                  | 53 +++++++++----------------
 28 files changed, 51 insertions(+), 171 deletions(-)
---
base-commit: 27d4815149ba0c80ef2db2a82f0512f647e76d62
change-id: 20250225-memory-drm-misc-next-b2444b488db2

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


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

* [PATCH RESEND 01/12] drm/aspeed: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 [PATCH RESEND 00/12] drm: Move to using devm_platform_ioremap_resource Anusha Srivatsa
@ 2025-02-25 22:20 ` Anusha Srivatsa
  2025-02-26 14:47   ` (subset) " Maxime Ripard
  2025-02-25 22:20 ` [PATCH RESEND 02/12] drm/fsl-dcu: " Anusha Srivatsa
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 24+ messages in thread
From: Anusha Srivatsa @ 2025-02-25 22:20 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Alain Volmat,
	Raphael Gallais-Pou, Yannick Fertre, Raphael Gallais-Pou,
	Philippe Cornu, Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc,
	Anusha Srivatsa

Replace platform_get_resource + devm_ioremap_resource
with just devm_platform_ioremap_resource()

Used Coccinelle to do this change. SmPl patch:
@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);

Cc: Joel Stanley <joel@jms.id.au>
Acked-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
index 397e677a691c2c6d199063f44358196a4569b389..46094cca297479d1cf19f6db99538c5e7a0fec92 100644
--- a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
+++ b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
@@ -144,11 +144,9 @@ static int aspeed_gfx_load(struct drm_device *drm)
 	struct aspeed_gfx *priv = to_aspeed_gfx(drm);
 	struct device_node *np = pdev->dev.of_node;
 	const struct aspeed_gfx_config *config;
-	struct resource *res;
 	int ret;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	priv->base = devm_ioremap_resource(drm->dev, res);
+	priv->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(priv->base))
 		return PTR_ERR(priv->base);
 

-- 
2.48.1


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

* [PATCH RESEND 02/12] drm/fsl-dcu: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 [PATCH RESEND 00/12] drm: Move to using devm_platform_ioremap_resource Anusha Srivatsa
  2025-02-25 22:20 ` [PATCH RESEND 01/12] drm/aspeed: move to devm_platform_ioremap_resource() usage Anusha Srivatsa
@ 2025-02-25 22:20 ` Anusha Srivatsa
  2025-02-25 22:20 ` [PATCH RESEND 03/12] drm/hisilicon: " Anusha Srivatsa
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Anusha Srivatsa @ 2025-02-25 22:20 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Alain Volmat,
	Raphael Gallais-Pou, Yannick Fertre, Raphael Gallais-Pou,
	Philippe Cornu, Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc,
	Anusha Srivatsa

Replace platform_get_resource + devm_ioremap_resource
with just devm_platform_ioremap_resource()

Used Coccinelle to do this change. SmPl patch:
@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);

Cc: Stefan Agner <stefan@agner.ch>
Cc: Alison Wang <alison.wang@nxp.com>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index 03b076db9381a5db0bff6576cda2772495a61fed..3bbfc1b56a6557e2f54d2b7ed099531053871341 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -260,7 +260,6 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
 	struct fsl_dcu_drm_device *fsl_dev;
 	struct drm_device *drm;
 	struct device *dev = &pdev->dev;
-	struct resource *res;
 	void __iomem *base;
 	struct clk *pix_clk_in;
 	char pix_clk_name[32];
@@ -278,8 +277,7 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
 		return -ENODEV;
 	fsl_dev->soc = id->data;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	base = devm_ioremap_resource(dev, res);
+	base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(base)) {
 		ret = PTR_ERR(base);
 		return ret;

-- 
2.48.1


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

* [PATCH RESEND 03/12] drm/hisilicon: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 [PATCH RESEND 00/12] drm: Move to using devm_platform_ioremap_resource Anusha Srivatsa
  2025-02-25 22:20 ` [PATCH RESEND 01/12] drm/aspeed: move to devm_platform_ioremap_resource() usage Anusha Srivatsa
  2025-02-25 22:20 ` [PATCH RESEND 02/12] drm/fsl-dcu: " Anusha Srivatsa
@ 2025-02-25 22:20 ` Anusha Srivatsa
  2025-02-25 22:20 ` [PATCH RESEND 04/12] drm/mediatek: " Anusha Srivatsa
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Anusha Srivatsa @ 2025-02-25 22:20 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Alain Volmat,
	Raphael Gallais-Pou, Yannick Fertre, Raphael Gallais-Pou,
	Philippe Cornu, Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc,
	Anusha Srivatsa

Replace platform_get_resource + devm_ioremap_resource
with just devm_platform_ioremap_resource()

Used Coccinelle to do this change. SmPl patch:
@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);

Cc: Xinliang Liu <xinliang.liu@linaro.org>
Cc: Tian Tao <tiantao6@hisilicon.com>
Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Yongqin Liu <yongqin.liu@linaro.org>
Cc: John Stultz <jstultz@google.com>

Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c    | 4 +---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
index 2eea9fb0e76bf3ead8f5914e6ebb65b5b3603b9a..e80debdc41763357cb2cf321205c0dfac80a911e 100644
--- a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
+++ b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
@@ -825,7 +825,6 @@ static const struct component_ops dsi_ops = {
 static int dsi_parse_dt(struct platform_device *pdev, struct dw_dsi *dsi)
 {
 	struct dsi_hw_ctx *ctx = dsi->ctx;
-	struct resource *res;
 
 	ctx->pclk = devm_clk_get(&pdev->dev, "pclk");
 	if (IS_ERR(ctx->pclk)) {
@@ -833,8 +832,7 @@ static int dsi_parse_dt(struct platform_device *pdev, struct dw_dsi *dsi)
 		return PTR_ERR(ctx->pclk);
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ctx->base = devm_ioremap_resource(&pdev->dev, res);
+	ctx->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(ctx->base)) {
 		DRM_ERROR("failed to remap dsi io region\n");
 		return PTR_ERR(ctx->base);
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index 2eb49177ac42bc6dba692328cca5c99d5925041c..45c4eb008ad5d639340f769ad022d186ec454722 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -844,7 +844,6 @@ static struct drm_plane_funcs ade_plane_funcs = {
 static void *ade_hw_ctx_alloc(struct platform_device *pdev,
 			      struct drm_crtc *crtc)
 {
-	struct resource *res;
 	struct device *dev = &pdev->dev;
 	struct device_node *np = pdev->dev.of_node;
 	struct ade_hw_ctx *ctx = NULL;
@@ -856,8 +855,7 @@ static void *ade_hw_ctx_alloc(struct platform_device *pdev,
 		return ERR_PTR(-ENOMEM);
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ctx->base = devm_ioremap_resource(dev, res);
+	ctx->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(ctx->base)) {
 		DRM_ERROR("failed to remap ade io base\n");
 		return ERR_PTR(-EIO);

-- 
2.48.1


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

* [PATCH RESEND 04/12] drm/mediatek: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 [PATCH RESEND 00/12] drm: Move to using devm_platform_ioremap_resource Anusha Srivatsa
                   ` (2 preceding siblings ...)
  2025-02-25 22:20 ` [PATCH RESEND 03/12] drm/hisilicon: " Anusha Srivatsa
@ 2025-02-25 22:20 ` Anusha Srivatsa
  2025-02-26 12:39   ` AngeloGioacchino Del Regno
  2025-02-26 14:47   ` (subset) " Maxime Ripard
  2025-02-25 22:20 ` [PATCH RESEND 05/12] drm/mxsfb: " Anusha Srivatsa
                   ` (7 subsequent siblings)
  11 siblings, 2 replies; 24+ messages in thread
From: Anusha Srivatsa @ 2025-02-25 22:20 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Alain Volmat,
	Raphael Gallais-Pou, Yannick Fertre, Raphael Gallais-Pou,
	Philippe Cornu, Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc,
	Anusha Srivatsa, CK Hu

Replace platform_get_resource + devm_ioremap_resource
with just devm_platform_ioremap_resource()

Used Coccinelle to do this change. SmPl patch:
@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);

Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 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 +---
 8 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_color.c b/drivers/gpu/drm/mediatek/mtk_disp_color.c
index dd8433a38282a9ba1bcc3a4ddd01dd89738ccb60..39c7de4cdcc16b56a5a1d046aaabaf5580227ed2 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_color.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_color.c
@@ -96,7 +96,6 @@ static int mtk_disp_color_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct mtk_disp_color *priv;
-	struct resource *res;
 	int ret;
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -108,8 +107,7 @@ static int mtk_disp_color_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, PTR_ERR(priv->clk),
 				     "failed to get color clk\n");
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	priv->regs = devm_ioremap_resource(dev, res);
+	priv->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(priv->regs))
 		return dev_err_probe(dev, PTR_ERR(priv->regs),
 				     "failed to ioremap color\n");
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
index b17b11d93846f2019d8c4afb294375333e22dc42..8afd15006df2a21f3f52fe00eca3c5501f4fb76a 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
@@ -256,7 +256,6 @@ static int mtk_disp_gamma_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct mtk_disp_gamma *priv;
-	struct resource *res;
 	int ret;
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -268,8 +267,7 @@ static int mtk_disp_gamma_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, PTR_ERR(priv->clk),
 				     "failed to get gamma clk\n");
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	priv->regs = devm_ioremap_resource(dev, res);
+	priv->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(priv->regs))
 		return dev_err_probe(dev, PTR_ERR(priv->regs),
 				     "failed to ioremap gamma\n");
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_merge.c b/drivers/gpu/drm/mediatek/mtk_disp_merge.c
index 563b1b248fbbb38ef03bb3e3ceecdd265961df60..b174dda091d3fbd16796e8e128b030fccf5b902c 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_merge.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_merge.c
@@ -306,7 +306,6 @@ static const struct component_ops mtk_disp_merge_component_ops = {
 static int mtk_disp_merge_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct resource *res;
 	struct mtk_disp_merge *priv;
 	int ret;
 
@@ -314,8 +313,7 @@ static int mtk_disp_merge_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	priv->regs = devm_ioremap_resource(dev, res);
+	priv->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(priv->regs))
 		return dev_err_probe(dev, PTR_ERR(priv->regs),
 				     "failed to ioremap merge\n");
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index df82cea4bb79c472acbb66e0df27fbad3e70bd20..d0581c4e3c999cf865fdd0aaf4c2f38dd404926e 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -604,7 +604,6 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct mtk_disp_ovl *priv;
-	struct resource *res;
 	int irq;
 	int ret;
 
@@ -621,8 +620,7 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, PTR_ERR(priv->clk),
 				     "failed to get ovl clk\n");
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	priv->regs = devm_ioremap_resource(dev, res);
+	priv->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(priv->regs))
 		return dev_err_probe(dev, PTR_ERR(priv->regs),
 				     "failed to ioremap ovl\n");
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
index bf47790e4d6be5d60070c63c15c75fa201cc4b27..c9d41d75e7f2a3af5820921b7e563da377ce8d0d 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
@@ -313,7 +313,6 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct mtk_disp_rdma *priv;
-	struct resource *res;
 	int irq;
 	int ret;
 
@@ -330,8 +329,7 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, PTR_ERR(priv->clk),
 				     "failed to get rdma clk\n");
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	priv->regs = devm_ioremap_resource(dev, res);
+	priv->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(priv->regs))
 		return dev_err_probe(dev, PTR_ERR(priv->regs),
 				     "failed to ioremap rdma\n");
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index b50dc9a013ac5a50e464134f548fa773a5662138..0683c2b3ca5bc5b09439c42d30fb1380e1c67c97 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1192,7 +1192,6 @@ static int mtk_dsi_probe(struct platform_device *pdev)
 {
 	struct mtk_dsi *dsi;
 	struct device *dev = &pdev->dev;
-	struct resource *regs;
 	int irq_num;
 	int ret;
 
@@ -1217,8 +1216,7 @@ static int mtk_dsi_probe(struct platform_device *pdev)
 	if (IS_ERR(dsi->hs_clk))
 		return dev_err_probe(dev, PTR_ERR(dsi->hs_clk), "Failed to get hs clock\n");
 
-	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	dsi->regs = devm_ioremap_resource(dev, regs);
+	dsi->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(dsi->regs))
 		return dev_err_probe(dev, PTR_ERR(dsi->regs), "Failed to ioremap memory\n");
 
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index ac5e40c2761710dfbe722e1ba569d76e4cd5b8fb..d4ab098e117477eea8fad568a134c0a796b380db 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -1424,7 +1424,6 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
 	struct device_node *cec_np, *remote, *i2c_np;
 	struct platform_device *cec_pdev;
 	struct regmap *regmap;
-	struct resource *mem;
 	int ret;
 
 	ret = mtk_hdmi_get_all_clk(hdmi, np);
@@ -1470,8 +1469,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
 	}
 	hdmi->sys_regmap = regmap;
 
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	hdmi->regs = devm_ioremap_resource(dev, mem);
+	hdmi->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(hdmi->regs)) {
 		ret = PTR_ERR(hdmi->regs);
 		goto put_device;
diff --git a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c
index fc69ee38ce7d6a245a7460cfde8de426e83b2e80..7982788ae9df51f1a378d8d538737f38af7299f2 100644
--- a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c
+++ b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c
@@ -291,7 +291,6 @@ static const struct component_ops mtk_mdp_rdma_component_ops = {
 static int mtk_mdp_rdma_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct resource *res;
 	struct mtk_mdp_rdma *priv;
 	int ret = 0;
 
@@ -299,8 +298,7 @@ static int mtk_mdp_rdma_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	priv->regs = devm_ioremap_resource(dev, res);
+	priv->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(priv->regs))
 		return dev_err_probe(dev, PTR_ERR(priv->regs),
 				     "failed to ioremap rdma\n");

-- 
2.48.1


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

* [PATCH RESEND 05/12] drm/mxsfb: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 [PATCH RESEND 00/12] drm: Move to using devm_platform_ioremap_resource Anusha Srivatsa
                   ` (3 preceding siblings ...)
  2025-02-25 22:20 ` [PATCH RESEND 04/12] drm/mediatek: " Anusha Srivatsa
@ 2025-02-25 22:20 ` Anusha Srivatsa
  2025-02-25 22:20 ` [PATCH RESEND 06/12] drm/sprd: " Anusha Srivatsa
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Anusha Srivatsa @ 2025-02-25 22:20 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Alain Volmat,
	Raphael Gallais-Pou, Yannick Fertre, Raphael Gallais-Pou,
	Philippe Cornu, Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc,
	Anusha Srivatsa

Replace platform_get_resource + devm_ioremap_resource
with just devm_platform_ioremap_resource()

Used Coccinelle to do this change. SmPl patch:
@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);

Cc: Marek Vasut <marex@denx.de>
Cc: Stefan Agner <stefan@agner.ch>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 drivers/gpu/drm/mxsfb/lcdif_drv.c | 4 +---
 drivers/gpu/drm/mxsfb/mxsfb_drv.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.c b/drivers/gpu/drm/mxsfb/lcdif_drv.c
index 8ee00f59ca821cea8e823e7100fb4d7534283994..fcb2a7517377e9a5bbd2997c578c579b1b079f92 100644
--- a/drivers/gpu/drm/mxsfb/lcdif_drv.c
+++ b/drivers/gpu/drm/mxsfb/lcdif_drv.c
@@ -134,7 +134,6 @@ static int lcdif_load(struct drm_device *drm)
 {
 	struct platform_device *pdev = to_platform_device(drm->dev);
 	struct lcdif_drm_private *lcdif;
-	struct resource *res;
 	int ret;
 
 	lcdif = devm_kzalloc(&pdev->dev, sizeof(*lcdif), GFP_KERNEL);
@@ -144,8 +143,7 @@ static int lcdif_load(struct drm_device *drm)
 	lcdif->drm = drm;
 	drm->dev_private = lcdif;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	lcdif->base = devm_ioremap_resource(drm->dev, res);
+	lcdif->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(lcdif->base))
 		return PTR_ERR(lcdif->base);
 
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 59020862cf65e5cc488903f1263ed16dfbce06f9..377d4c4c9979ad9538cfec5464827a82936f811b 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -215,7 +215,6 @@ static int mxsfb_load(struct drm_device *drm,
 {
 	struct platform_device *pdev = to_platform_device(drm->dev);
 	struct mxsfb_drm_private *mxsfb;
-	struct resource *res;
 	int ret;
 
 	mxsfb = devm_kzalloc(&pdev->dev, sizeof(*mxsfb), GFP_KERNEL);
@@ -226,8 +225,7 @@ static int mxsfb_load(struct drm_device *drm,
 	drm->dev_private = mxsfb;
 	mxsfb->devdata = devdata;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	mxsfb->base = devm_ioremap_resource(drm->dev, res);
+	mxsfb->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(mxsfb->base))
 		return PTR_ERR(mxsfb->base);
 

-- 
2.48.1


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

* [PATCH RESEND 06/12] drm/sprd: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 [PATCH RESEND 00/12] drm: Move to using devm_platform_ioremap_resource Anusha Srivatsa
                   ` (4 preceding siblings ...)
  2025-02-25 22:20 ` [PATCH RESEND 05/12] drm/mxsfb: " Anusha Srivatsa
@ 2025-02-25 22:20 ` Anusha Srivatsa
  2025-02-27  1:52   ` Chunyan Zhang
  2025-02-25 22:20 ` [PATCH RESEND 07/12] drm/sti: " Anusha Srivatsa
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 24+ messages in thread
From: Anusha Srivatsa @ 2025-02-25 22:20 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Alain Volmat,
	Raphael Gallais-Pou, Yannick Fertre, Raphael Gallais-Pou,
	Philippe Cornu, Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc,
	Anusha Srivatsa, Dmitry Baryshkov

Replace platform_get_resource + devm_ioremap
with just devm_platform_ioremap_resource()

Used Coccinelle to do this change. SmPl patch:
@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);

Cc: Chunyan Zhang <zhang.lyra@gmail.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 drivers/gpu/drm/sprd/sprd_dpu.c | 9 +--------
 drivers/gpu/drm/sprd/sprd_dsi.c | 9 +--------
 2 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dpu.c
index cb2816985305fd19eac27413c214681a5a1e9ffa..65cd5aa1634eee5a6735ccffa4ee3979844d92ce 100644
--- a/drivers/gpu/drm/sprd/sprd_dpu.c
+++ b/drivers/gpu/drm/sprd/sprd_dpu.c
@@ -784,16 +784,9 @@ static int sprd_dpu_context_init(struct sprd_dpu *dpu,
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct dpu_context *ctx = &dpu->ctx;
-	struct resource *res;
 	int ret;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(dev, "failed to get I/O resource\n");
-		return -EINVAL;
-	}
-
-	ctx->base = devm_ioremap(dev, res->start, resource_size(res));
+	ctx->base = devm_platform_ioremap_resource(pdev, 0);
 	if (!ctx->base) {
 		dev_err(dev, "failed to map dpu registers\n");
 		return -EFAULT;
diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_dsi.c
index 8fc26479bb6bce0aa94914f49d0986a7e19326c1..1668bb4166ab0ad3812c5654244544a9caf249a6 100644
--- a/drivers/gpu/drm/sprd/sprd_dsi.c
+++ b/drivers/gpu/drm/sprd/sprd_dsi.c
@@ -901,15 +901,8 @@ static int sprd_dsi_context_init(struct sprd_dsi *dsi,
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct dsi_context *ctx = &dsi->ctx;
-	struct resource *res;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(dev, "failed to get I/O resource\n");
-		return -EINVAL;
-	}
-
-	ctx->base = devm_ioremap(dev, res->start, resource_size(res));
+	ctx->base = devm_platform_ioremap_resource(pdev, 0);
 	if (!ctx->base) {
 		drm_err(dsi->drm, "failed to map dsi host registers\n");
 		return -ENXIO;

-- 
2.48.1


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

* [PATCH RESEND 07/12] drm/sti: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 [PATCH RESEND 00/12] drm: Move to using devm_platform_ioremap_resource Anusha Srivatsa
                   ` (5 preceding siblings ...)
  2025-02-25 22:20 ` [PATCH RESEND 06/12] drm/sprd: " Anusha Srivatsa
@ 2025-02-25 22:20 ` Anusha Srivatsa
  2025-02-26  9:06   ` Raphael Gallais-Pou
  2025-02-25 22:20 ` [PATCH RESEND 08/12] drm/stm: " Anusha Srivatsa
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 24+ messages in thread
From: Anusha Srivatsa @ 2025-02-25 22:20 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Alain Volmat,
	Raphael Gallais-Pou, Yannick Fertre, Raphael Gallais-Pou,
	Philippe Cornu, Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc,
	Anusha Srivatsa

Replace platform_get_resource/_byname + devm_ioremap
with just devm_platform_ioremap_resource()

Used Coccinelle to do this change. SmPl patch:

@rule@
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);

and
@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);

v2: Fix compilation error.

Cc: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Cc: Alain Volmat <alain.volmat@foss.st.com>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 drivers/gpu/drm/sti/sti_compositor.c | 10 +---------
 drivers/gpu/drm/sti/sti_dvo.c        | 10 +---------
 drivers/gpu/drm/sti/sti_hda.c        |  9 +--------
 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 +---------
 7 files changed, 7 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c
index 063f82d23d80c4ba83624a0066a18416a2b37351..7aefce6706ba2cd7d97a33228c9b9812edecf06f 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -177,7 +177,6 @@ static int sti_compositor_probe(struct platform_device *pdev)
 	struct device_node *np = dev->of_node;
 	struct device_node *vtg_np;
 	struct sti_compositor *compo;
-	struct resource *res;
 	unsigned int i;
 
 	compo = devm_kzalloc(dev, sizeof(*compo), GFP_KERNEL);
@@ -194,14 +193,7 @@ static int sti_compositor_probe(struct platform_device *pdev)
 
 	memcpy(&compo->data, of_match_node(compositor_of_match, np)->data,
 	       sizeof(struct sti_compositor_data));
-
-	/* Get Memory ressources */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (res == NULL) {
-		DRM_ERROR("Get memory resource failed\n");
-		return -ENXIO;
-	}
-	compo->regs = devm_ioremap(dev, res->start, resource_size(res));
+	compo->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (compo->regs == NULL) {
 		DRM_ERROR("Register mapping failed\n");
 		return -ENXIO;
diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index 4dcddd02629b6a1052be8fb8333bd3aa17c083c5..c877298a7f2bad171724eca4d43ea622db4c81cd 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -511,7 +511,6 @@ static int sti_dvo_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct sti_dvo *dvo;
-	struct resource *res;
 	struct device_node *np = dev->of_node;
 
 	DRM_INFO("%s\n", __func__);
@@ -523,14 +522,7 @@ static int sti_dvo_probe(struct platform_device *pdev)
 	}
 
 	dvo->dev = pdev->dev;
-
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dvo-reg");
-	if (!res) {
-		DRM_ERROR("Invalid dvo resource\n");
-		return -ENOMEM;
-	}
-	dvo->regs = devm_ioremap(dev, res->start,
-			resource_size(res));
+	dvo->regs = devm_platform_ioremap_resource_byname(pdev, "dvo-reg");
 	if (!dvo->regs)
 		return -ENOMEM;
 
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index 14fdc00d2ba03d4f96ba407ac8e576decb6f32c0..3ca3abb80d425901f4c031edfd327a770d624e1c 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -750,14 +750,7 @@ static int sti_hda_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	hda->dev = pdev->dev;
-
-	/* Get resources */
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hda-reg");
-	if (!res) {
-		DRM_ERROR("Invalid hda resource\n");
-		return -ENOMEM;
-	}
-	hda->regs = devm_ioremap(dev, res->start, resource_size(res));
+	hda->regs = devm_platform_ioremap_resource_byname(pdev, "hda-reg");
 	if (!hda->regs)
 		return -ENOMEM;
 
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 164a34d793d86f114394048667ae3189e1c39242..c64ce7a1ef58b9ce4429edd368269bea87d86984 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -1380,7 +1380,6 @@ static int sti_hdmi_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct sti_hdmi *hdmi;
 	struct device_node *np = dev->of_node;
-	struct resource *res;
 	struct device_node *ddc;
 	int ret;
 
@@ -1399,15 +1398,7 @@ static int sti_hdmi_probe(struct platform_device *pdev)
 	}
 
 	hdmi->dev = pdev->dev;
-
-	/* Get resources */
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hdmi-reg");
-	if (!res) {
-		DRM_ERROR("Invalid hdmi resource\n");
-		ret = -ENOMEM;
-		goto release_adapter;
-	}
-	hdmi->regs = devm_ioremap(dev, res->start, resource_size(res));
+	hdmi->regs = devm_platform_ioremap_resource_byname(pdev, "hdmi-reg");
 	if (!hdmi->regs) {
 		ret = -ENOMEM;
 		goto release_adapter;
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index 0f658709c9d0d398c4eed65202443db9d0b41f8c..420395598d119a403d531211022e6005d6a2bd59 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -1356,7 +1356,6 @@ static int sti_hqvdp_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct device_node *vtg_np;
 	struct sti_hqvdp *hqvdp;
-	struct resource *res;
 
 	DRM_DEBUG_DRIVER("\n");
 
@@ -1367,14 +1366,7 @@ static int sti_hqvdp_probe(struct platform_device *pdev)
 	}
 
 	hqvdp->dev = dev;
-
-	/* Get Memory resources */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		DRM_ERROR("Get memory resource failed\n");
-		return -ENXIO;
-	}
-	hqvdp->regs = devm_ioremap(dev, res->start, resource_size(res));
+	hqvdp->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (!hqvdp->regs) {
 		DRM_ERROR("Register mapping failed\n");
 		return -ENXIO;
diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index af6c06f448c4819def8cc0d0836e30f991529690..0bebe815f5e7567f84388af93723a6fa7d2cc7a2 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -838,7 +838,6 @@ static int sti_tvout_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct device_node *node = dev->of_node;
 	struct sti_tvout *tvout;
-	struct resource *res;
 
 	DRM_INFO("%s\n", __func__);
 
@@ -850,14 +849,7 @@ static int sti_tvout_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	tvout->dev = dev;
-
-	/* get memory resources */
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tvout-reg");
-	if (!res) {
-		DRM_ERROR("Invalid glue resource\n");
-		return -ENOMEM;
-	}
-	tvout->regs = devm_ioremap(dev, res->start, resource_size(res));
+	tvout->regs = devm_platform_ioremap_resource_byname(pdev, "tvout-reg");
 	if (!tvout->regs)
 		return -ENOMEM;
 
diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c
index 5ba469b711b5318e9e9e6d8df127fb8933d1fac1..b5353fe774d72fd629ecd3ef75a5d2817ca8617f 100644
--- a/drivers/gpu/drm/sti/sti_vtg.c
+++ b/drivers/gpu/drm/sti/sti_vtg.c
@@ -380,20 +380,12 @@ static int vtg_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct sti_vtg *vtg;
-	struct resource *res;
 	int ret;
 
 	vtg = devm_kzalloc(dev, sizeof(*vtg), GFP_KERNEL);
 	if (!vtg)
 		return -ENOMEM;
-
-	/* Get Memory ressources */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		DRM_ERROR("Get memory resource failed\n");
-		return -ENOMEM;
-	}
-	vtg->regs = devm_ioremap(dev, res->start, resource_size(res));
+	vtg->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (!vtg->regs) {
 		DRM_ERROR("failed to remap I/O memory\n");
 		return -ENOMEM;

-- 
2.48.1


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

* [PATCH RESEND 08/12] drm/stm: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 [PATCH RESEND 00/12] drm: Move to using devm_platform_ioremap_resource Anusha Srivatsa
                   ` (6 preceding siblings ...)
  2025-02-25 22:20 ` [PATCH RESEND 07/12] drm/sti: " Anusha Srivatsa
@ 2025-02-25 22:20 ` Anusha Srivatsa
  2025-02-26 14:47   ` (subset) " Maxime Ripard
  2025-02-25 22:20 ` [PATCH RESEND 09/12] drm/tegra: " Anusha Srivatsa
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 24+ messages in thread
From: Anusha Srivatsa @ 2025-02-25 22:20 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Alain Volmat,
	Raphael Gallais-Pou, Yannick Fertre, Raphael Gallais-Pou,
	Philippe Cornu, Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc,
	Anusha Srivatsa

Replace platform_get_resource + devm_ioremap_resource
with just devm_platform_ioremap_resource()

Used Coccinelle to do this change. SmPl patch:
@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);

Cc: Yannick Fertre <yannick.fertre@foss.st.com>
Cc: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Cc: Philippe Cornu <philippe.cornu@foss.st.com>
Acked-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 drivers/gpu/drm/stm/ltdc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 54a73753eff98902012c6012914fa8c6482affbd..ba315c66a04d72758b9d3cfcd842432877f66d3a 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -1900,7 +1900,6 @@ int ltdc_load(struct drm_device *ddev)
 	struct drm_panel *panel;
 	struct drm_crtc *crtc;
 	struct reset_control *rstc;
-	struct resource *res;
 	int irq, i, nb_endpoints;
 	int ret = -ENODEV;
 
@@ -1966,8 +1965,7 @@ int ltdc_load(struct drm_device *ddev)
 		reset_control_deassert(rstc);
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ldev->regs = devm_ioremap_resource(dev, res);
+	ldev->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(ldev->regs)) {
 		DRM_ERROR("Unable to get ltdc registers\n");
 		ret = PTR_ERR(ldev->regs);

-- 
2.48.1


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

* [PATCH RESEND 09/12] drm/tegra: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 [PATCH RESEND 00/12] drm: Move to using devm_platform_ioremap_resource Anusha Srivatsa
                   ` (7 preceding siblings ...)
  2025-02-25 22:20 ` [PATCH RESEND 08/12] drm/stm: " Anusha Srivatsa
@ 2025-02-25 22:20 ` Anusha Srivatsa
  2025-02-25 22:20 ` [PATCH RESEND 10/12] drm/tiny: " Anusha Srivatsa
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Anusha Srivatsa @ 2025-02-25 22:20 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Alain Volmat,
	Raphael Gallais-Pou, Yannick Fertre, Raphael Gallais-Pou,
	Philippe Cornu, Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc,
	Anusha Srivatsa

Replace platform_get_resource + devm_ioremap_resource
with just devm_platform_ioremap_resource()

Used Coccinelle to do this change. SmPl patch:
@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);

Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 drivers/gpu/drm/tegra/dsi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index 9bb077558167293c8e47ca9578cef13172b0b22f..b5089b7722676cfaee5d28216af4ae706a47f895 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -1564,7 +1564,6 @@ static int tegra_dsi_ganged_probe(struct tegra_dsi *dsi)
 static int tegra_dsi_probe(struct platform_device *pdev)
 {
 	struct tegra_dsi *dsi;
-	struct resource *regs;
 	int err;
 
 	dsi = devm_kzalloc(&pdev->dev, sizeof(*dsi), GFP_KERNEL);
@@ -1636,8 +1635,7 @@ static int tegra_dsi_probe(struct platform_device *pdev)
 		goto remove;
 	}
 
-	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	dsi->regs = devm_ioremap_resource(&pdev->dev, regs);
+	dsi->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(dsi->regs)) {
 		err = PTR_ERR(dsi->regs);
 		goto remove;

-- 
2.48.1


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

* [PATCH RESEND 10/12] drm/tiny: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 [PATCH RESEND 00/12] drm: Move to using devm_platform_ioremap_resource Anusha Srivatsa
                   ` (8 preceding siblings ...)
  2025-02-25 22:20 ` [PATCH RESEND 09/12] drm/tegra: " Anusha Srivatsa
@ 2025-02-25 22:20 ` Anusha Srivatsa
  2025-02-26 14:47   ` (subset) " Maxime Ripard
  2025-02-25 22:20 ` [PATCH RESEND 11/12] drm/vc4: " Anusha Srivatsa
  2025-02-25 22:20 ` [PATCH RESEND 12/12] Documentation: Update the todo Anusha Srivatsa
  11 siblings, 1 reply; 24+ messages in thread
From: Anusha Srivatsa @ 2025-02-25 22:20 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Alain Volmat,
	Raphael Gallais-Pou, Yannick Fertre, Raphael Gallais-Pou,
	Philippe Cornu, Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc,
	Anusha Srivatsa

Replace platform_get_resource + devm_ioremap_resource
with just devm_platform_ioremap_resource()

Used Coccinelle to do this change. SmPl patch:
@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);

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 drivers/gpu/drm/tiny/arcpgu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/tiny/arcpgu.c b/drivers/gpu/drm/tiny/arcpgu.c
index 2748d1f21d8697275047886865a5518792a4dd7c..7cf0f0ea1bfe4fa82234a120b52837e26a8ee5b0 100644
--- a/drivers/gpu/drm/tiny/arcpgu.c
+++ b/drivers/gpu/drm/tiny/arcpgu.c
@@ -253,7 +253,6 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu)
 	struct device_node *encoder_node = NULL, *endpoint_node = NULL;
 	struct drm_connector *connector = NULL;
 	struct drm_device *drm = &arcpgu->drm;
-	struct resource *res;
 	int ret;
 
 	arcpgu->clk = devm_clk_get(drm->dev, "pxlclk");
@@ -270,8 +269,7 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu)
 	drm->mode_config.max_height = 1080;
 	drm->mode_config.funcs = &arcpgu_drm_modecfg_funcs;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	arcpgu->regs = devm_ioremap_resource(&pdev->dev, res);
+	arcpgu->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(arcpgu->regs))
 		return PTR_ERR(arcpgu->regs);
 

-- 
2.48.1


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

* [PATCH RESEND 11/12] drm/vc4: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 [PATCH RESEND 00/12] drm: Move to using devm_platform_ioremap_resource Anusha Srivatsa
                   ` (9 preceding siblings ...)
  2025-02-25 22:20 ` [PATCH RESEND 10/12] drm/tiny: " Anusha Srivatsa
@ 2025-02-25 22:20 ` Anusha Srivatsa
  2025-02-26 14:47   ` (subset) " Maxime Ripard
  2025-02-25 22:20 ` [PATCH RESEND 12/12] Documentation: Update the todo Anusha Srivatsa
  11 siblings, 1 reply; 24+ messages in thread
From: Anusha Srivatsa @ 2025-02-25 22:20 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Alain Volmat,
	Raphael Gallais-Pou, Yannick Fertre, Raphael Gallais-Pou,
	Philippe Cornu, Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc,
	Anusha Srivatsa

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>
---
 drivers/gpu/drm/vc4/vc4_hdmi.c | 53 ++++++++++++++----------------------------
 1 file changed, 18 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index e878eddc9c3f669f29b098d892baa463446617ef..d20e5c53ba75d43a6f478cf7ab837a0878f68ab2 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -2926,15 +2926,16 @@ static int vc5_hdmi_init_resources(struct drm_device *drm,
 	struct resource *res;
 	int ret;
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hdmi");
-	if (!res)
-		return -ENODEV;
-
-	vc4_hdmi->hdmicore_regs = devm_ioremap(dev, res->start,
-					       resource_size(res));
+	vc4_hdmi->hdmicore_regs = devm_platform_ioremap_resource_byname(pdev,
+									"hdmi");
 	if (!vc4_hdmi->hdmicore_regs)
 		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");
 	if (!res)
 		return -ENODEV;
@@ -2943,51 +2944,33 @@ static int vc5_hdmi_init_resources(struct drm_device *drm,
 	if (!vc4_hdmi->hd_regs)
 		return -ENOMEM;
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cec");
-	if (!res)
-		return -ENODEV;
-
-	vc4_hdmi->cec_regs = devm_ioremap(dev, res->start, resource_size(res));
+	vc4_hdmi->cec_regs = devm_platform_ioremap_resource_byname(pdev,
+								   "cec");
 	if (!vc4_hdmi->cec_regs)
 		return -ENOMEM;
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "csc");
-	if (!res)
-		return -ENODEV;
-
-	vc4_hdmi->csc_regs = devm_ioremap(dev, res->start, resource_size(res));
+	vc4_hdmi->csc_regs = devm_platform_ioremap_resource_byname(pdev,
+								   "csc");
 	if (!vc4_hdmi->csc_regs)
 		return -ENOMEM;
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dvp");
-	if (!res)
-		return -ENODEV;
-
-	vc4_hdmi->dvp_regs = devm_ioremap(dev, res->start, resource_size(res));
+	vc4_hdmi->dvp_regs = devm_platform_ioremap_resource_byname(pdev,
+								   "dvp");
 	if (!vc4_hdmi->dvp_regs)
 		return -ENOMEM;
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy");
-	if (!res)
-		return -ENODEV;
+	vc4_hdmi->phy_regs = devm_platform_ioremap_resource_byname(pdev,
+								   "phy");
 
-	vc4_hdmi->phy_regs = devm_ioremap(dev, res->start, resource_size(res));
 	if (!vc4_hdmi->phy_regs)
 		return -ENOMEM;
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "packet");
-	if (!res)
-		return -ENODEV;
-
-	vc4_hdmi->ram_regs = devm_ioremap(dev, res->start, resource_size(res));
+	vc4_hdmi->ram_regs = devm_platform_ioremap_resource_byname(pdev,
+								   "packet");
 	if (!vc4_hdmi->ram_regs)
 		return -ENOMEM;
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rm");
-	if (!res)
-		return -ENODEV;
-
-	vc4_hdmi->rm_regs = devm_ioremap(dev, res->start, resource_size(res));
+	vc4_hdmi->rm_regs = devm_platform_ioremap_resource_byname(pdev, "rm");
 	if (!vc4_hdmi->rm_regs)
 		return -ENOMEM;
 

-- 
2.48.1


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

* [PATCH RESEND 12/12] Documentation: Update the todo
  2025-02-25 22:20 [PATCH RESEND 00/12] drm: Move to using devm_platform_ioremap_resource Anusha Srivatsa
                   ` (10 preceding siblings ...)
  2025-02-25 22:20 ` [PATCH RESEND 11/12] drm/vc4: " Anusha Srivatsa
@ 2025-02-25 22:20 ` Anusha Srivatsa
  2025-02-26 10:21   ` Thomas Zimmermann
  11 siblings, 1 reply; 24+ messages in thread
From: Anusha Srivatsa @ 2025-02-25 22:20 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Alain Volmat,
	Raphael Gallais-Pou, Yannick Fertre, Raphael Gallais-Pou,
	Philippe Cornu, Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc,
	Anusha Srivatsa

Update the Documentation to be more precise.

v2: Update for clarity
v3: Further details in Todo

Cc: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 Documentation/gpu/todo.rst | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
index 256d0d1cb2164bd94f9b610a751b907834d96a21..c57777a24e03d91b1ffe04365f7356f2d938befd 100644
--- a/Documentation/gpu/todo.rst
+++ b/Documentation/gpu/todo.rst
@@ -441,14 +441,15 @@ Contact: Thomas Zimmermann <tzimmermann@suse.de>
 
 Level: Intermediate
 
-Request memory regions in all drivers
--------------------------------------
+Request memory regions in all fbdev drivers
+--------------------------------------------
 
-Go through all drivers and add code to request the memory regions that the
-driver uses. This requires adding calls to request_mem_region(),
+Old/ancient fbdev drivers do not request their memory properly.
+Go through these drivers and add code to request the memory regions
+that the driver uses. This requires adding calls to request_mem_region(),
 pci_request_region() or similar functions. Use helpers for managed cleanup
-where possible.
-
+where possible. Problematic areas include hardware that has exclusive ranges
+like VGA. VGA16fb does not request the range as it is expected.
 Drivers are pretty bad at doing this and there used to be conflicts among
 DRM and fbdev drivers. Still, it's the correct thing to do.
 

-- 
2.48.1


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

* Re: [PATCH RESEND 07/12] drm/sti: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 ` [PATCH RESEND 07/12] drm/sti: " Anusha Srivatsa
@ 2025-02-26  9:06   ` Raphael Gallais-Pou
       [not found]     ` <CAN9Xe3Q8=_Tz51i6gxNM6445p-rhNiK7B5Ljcga8g_Nn676dCQ@mail.gmail.com>
  0 siblings, 1 reply; 24+ messages in thread
From: Raphael Gallais-Pou @ 2025-02-26  9:06 UTC (permalink / raw)
  To: Anusha Srivatsa, Joel Stanley, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Andrew Jeffery,
	Stefan Agner, Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong,
	Sumit Semwal, Yongqin Liu, John Stultz, Chun-Kuang Hu,
	Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
	Marek Vasut, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Alain Volmat, Raphael Gallais-Pou, Yannick Fertre, Philippe Cornu,
	Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc


On 2/25/25 23:20, 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@
> 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);
>
> and
> @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);
>
> v2: Fix compilation error.


Hi Anusha, 


You did not take into account my comment regarding the changelog. :-)
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#commentary

While the commit summary do not specify the version, this changelog suggests
that the version of your series as been incremented.
If this is a v2, then a version descriptor should be applied to the patchset.
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#subject-line


Regards,
Raphaël

>
> Cc: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
> Cc: Alain Volmat <alain.volmat@foss.st.com>
> Reviewed-by: Maxime Ripard <mripard@kernel.org>
> Acked-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
> Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
> ---
>  drivers/gpu/drm/sti/sti_compositor.c | 10 +---------
>  drivers/gpu/drm/sti/sti_dvo.c        | 10 +---------
>  drivers/gpu/drm/sti/sti_hda.c        |  9 +--------
>  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 +---------
>  7 files changed, 7 insertions(+), 63 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c
> index 063f82d23d80c4ba83624a0066a18416a2b37351..7aefce6706ba2cd7d97a33228c9b9812edecf06f 100644
> --- a/drivers/gpu/drm/sti/sti_compositor.c
> +++ b/drivers/gpu/drm/sti/sti_compositor.c
> @@ -177,7 +177,6 @@ static int sti_compositor_probe(struct platform_device *pdev)
>  	struct device_node *np = dev->of_node;
>  	struct device_node *vtg_np;
>  	struct sti_compositor *compo;
> -	struct resource *res;
>  	unsigned int i;
>  
>  	compo = devm_kzalloc(dev, sizeof(*compo), GFP_KERNEL);
> @@ -194,14 +193,7 @@ static int sti_compositor_probe(struct platform_device *pdev)
>  
>  	memcpy(&compo->data, of_match_node(compositor_of_match, np)->data,
>  	       sizeof(struct sti_compositor_data));
> -
> -	/* Get Memory ressources */
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (res == NULL) {
> -		DRM_ERROR("Get memory resource failed\n");
> -		return -ENXIO;
> -	}
> -	compo->regs = devm_ioremap(dev, res->start, resource_size(res));
> +	compo->regs = devm_platform_ioremap_resource(pdev, 0);
>  	if (compo->regs == NULL) {
>  		DRM_ERROR("Register mapping failed\n");
>  		return -ENXIO;
> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
> index 4dcddd02629b6a1052be8fb8333bd3aa17c083c5..c877298a7f2bad171724eca4d43ea622db4c81cd 100644
> --- a/drivers/gpu/drm/sti/sti_dvo.c
> +++ b/drivers/gpu/drm/sti/sti_dvo.c
> @@ -511,7 +511,6 @@ static int sti_dvo_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
>  	struct sti_dvo *dvo;
> -	struct resource *res;
>  	struct device_node *np = dev->of_node;
>  
>  	DRM_INFO("%s\n", __func__);
> @@ -523,14 +522,7 @@ static int sti_dvo_probe(struct platform_device *pdev)
>  	}
>  
>  	dvo->dev = pdev->dev;
> -
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dvo-reg");
> -	if (!res) {
> -		DRM_ERROR("Invalid dvo resource\n");
> -		return -ENOMEM;
> -	}
> -	dvo->regs = devm_ioremap(dev, res->start,
> -			resource_size(res));
> +	dvo->regs = devm_platform_ioremap_resource_byname(pdev, "dvo-reg");
>  	if (!dvo->regs)
>  		return -ENOMEM;
>  
> diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
> index 14fdc00d2ba03d4f96ba407ac8e576decb6f32c0..3ca3abb80d425901f4c031edfd327a770d624e1c 100644
> --- a/drivers/gpu/drm/sti/sti_hda.c
> +++ b/drivers/gpu/drm/sti/sti_hda.c
> @@ -750,14 +750,7 @@ static int sti_hda_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	hda->dev = pdev->dev;
> -
> -	/* Get resources */
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hda-reg");
> -	if (!res) {
> -		DRM_ERROR("Invalid hda resource\n");
> -		return -ENOMEM;
> -	}
> -	hda->regs = devm_ioremap(dev, res->start, resource_size(res));
> +	hda->regs = devm_platform_ioremap_resource_byname(pdev, "hda-reg");
>  	if (!hda->regs)
>  		return -ENOMEM;
>  
> diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
> index 164a34d793d86f114394048667ae3189e1c39242..c64ce7a1ef58b9ce4429edd368269bea87d86984 100644
> --- a/drivers/gpu/drm/sti/sti_hdmi.c
> +++ b/drivers/gpu/drm/sti/sti_hdmi.c
> @@ -1380,7 +1380,6 @@ static int sti_hdmi_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct sti_hdmi *hdmi;
>  	struct device_node *np = dev->of_node;
> -	struct resource *res;
>  	struct device_node *ddc;
>  	int ret;
>  
> @@ -1399,15 +1398,7 @@ static int sti_hdmi_probe(struct platform_device *pdev)
>  	}
>  
>  	hdmi->dev = pdev->dev;
> -
> -	/* Get resources */
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hdmi-reg");
> -	if (!res) {
> -		DRM_ERROR("Invalid hdmi resource\n");
> -		ret = -ENOMEM;
> -		goto release_adapter;
> -	}
> -	hdmi->regs = devm_ioremap(dev, res->start, resource_size(res));
> +	hdmi->regs = devm_platform_ioremap_resource_byname(pdev, "hdmi-reg");
>  	if (!hdmi->regs) {
>  		ret = -ENOMEM;
>  		goto release_adapter;
> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
> index 0f658709c9d0d398c4eed65202443db9d0b41f8c..420395598d119a403d531211022e6005d6a2bd59 100644
> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
> @@ -1356,7 +1356,6 @@ static int sti_hqvdp_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct device_node *vtg_np;
>  	struct sti_hqvdp *hqvdp;
> -	struct resource *res;
>  
>  	DRM_DEBUG_DRIVER("\n");
>  
> @@ -1367,14 +1366,7 @@ static int sti_hqvdp_probe(struct platform_device *pdev)
>  	}
>  
>  	hqvdp->dev = dev;
> -
> -	/* Get Memory resources */
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res) {
> -		DRM_ERROR("Get memory resource failed\n");
> -		return -ENXIO;
> -	}
> -	hqvdp->regs = devm_ioremap(dev, res->start, resource_size(res));
> +	hqvdp->regs = devm_platform_ioremap_resource(pdev, 0);
>  	if (!hqvdp->regs) {
>  		DRM_ERROR("Register mapping failed\n");
>  		return -ENXIO;
> diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
> index af6c06f448c4819def8cc0d0836e30f991529690..0bebe815f5e7567f84388af93723a6fa7d2cc7a2 100644
> --- a/drivers/gpu/drm/sti/sti_tvout.c
> +++ b/drivers/gpu/drm/sti/sti_tvout.c
> @@ -838,7 +838,6 @@ static int sti_tvout_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct device_node *node = dev->of_node;
>  	struct sti_tvout *tvout;
> -	struct resource *res;
>  
>  	DRM_INFO("%s\n", __func__);
>  
> @@ -850,14 +849,7 @@ static int sti_tvout_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	tvout->dev = dev;
> -
> -	/* get memory resources */
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tvout-reg");
> -	if (!res) {
> -		DRM_ERROR("Invalid glue resource\n");
> -		return -ENOMEM;
> -	}
> -	tvout->regs = devm_ioremap(dev, res->start, resource_size(res));
> +	tvout->regs = devm_platform_ioremap_resource_byname(pdev, "tvout-reg");
>  	if (!tvout->regs)
>  		return -ENOMEM;
>  
> diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c
> index 5ba469b711b5318e9e9e6d8df127fb8933d1fac1..b5353fe774d72fd629ecd3ef75a5d2817ca8617f 100644
> --- a/drivers/gpu/drm/sti/sti_vtg.c
> +++ b/drivers/gpu/drm/sti/sti_vtg.c
> @@ -380,20 +380,12 @@ static int vtg_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
>  	struct sti_vtg *vtg;
> -	struct resource *res;
>  	int ret;
>  
>  	vtg = devm_kzalloc(dev, sizeof(*vtg), GFP_KERNEL);
>  	if (!vtg)
>  		return -ENOMEM;
> -
> -	/* Get Memory ressources */
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res) {
> -		DRM_ERROR("Get memory resource failed\n");
> -		return -ENOMEM;
> -	}
> -	vtg->regs = devm_ioremap(dev, res->start, resource_size(res));
> +	vtg->regs = devm_platform_ioremap_resource(pdev, 0);
>  	if (!vtg->regs) {
>  		DRM_ERROR("failed to remap I/O memory\n");
>  		return -ENOMEM;
>

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

* Re: [PATCH RESEND 12/12] Documentation: Update the todo
  2025-02-25 22:20 ` [PATCH RESEND 12/12] Documentation: Update the todo Anusha Srivatsa
@ 2025-02-26 10:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 24+ messages in thread
From: Thomas Zimmermann @ 2025-02-26 10:21 UTC (permalink / raw)
  To: Anusha Srivatsa, Joel Stanley, Maarten Lankhorst, Maxime Ripard,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Alain Volmat,
	Raphael Gallais-Pou, Yannick Fertre, Raphael Gallais-Pou,
	Philippe Cornu, Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc



Am 25.02.25 um 23:20 schrieb Anusha Srivatsa:
> Update the Documentation to be more precise.
>
> v2: Update for clarity
> v3: Further details in Todo
>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

Thanks for the update.

> ---
>   Documentation/gpu/todo.rst | 13 +++++++------
>   1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
> index 256d0d1cb2164bd94f9b610a751b907834d96a21..c57777a24e03d91b1ffe04365f7356f2d938befd 100644
> --- a/Documentation/gpu/todo.rst
> +++ b/Documentation/gpu/todo.rst
> @@ -441,14 +441,15 @@ Contact: Thomas Zimmermann <tzimmermann@suse.de>
>   
>   Level: Intermediate
>   
> -Request memory regions in all drivers
> --------------------------------------
> +Request memory regions in all fbdev drivers
> +--------------------------------------------
>   
> -Go through all drivers and add code to request the memory regions that the
> -driver uses. This requires adding calls to request_mem_region(),
> +Old/ancient fbdev drivers do not request their memory properly.
> +Go through these drivers and add code to request the memory regions
> +that the driver uses. This requires adding calls to request_mem_region(),
>   pci_request_region() or similar functions. Use helpers for managed cleanup
> -where possible.
> -
> +where possible. Problematic areas include hardware that has exclusive ranges
> +like VGA. VGA16fb does not request the range as it is expected.
>   Drivers are pretty bad at doing this and there used to be conflicts among
>   DRM and fbdev drivers. Still, it's the correct thing to do.
>   
>

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


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

* Re: [PATCH RESEND 04/12] drm/mediatek: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 ` [PATCH RESEND 04/12] drm/mediatek: " Anusha Srivatsa
@ 2025-02-26 12:39   ` AngeloGioacchino Del Regno
  2025-02-26 14:47   ` (subset) " Maxime Ripard
  1 sibling, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-02-26 12:39 UTC (permalink / raw)
  To: Anusha Srivatsa, Joel Stanley, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Andrew Jeffery,
	Stefan Agner, Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong,
	Sumit Semwal, Yongqin Liu, John Stultz, Chun-Kuang Hu,
	Philipp Zabel, Matthias Brugger, Marek Vasut, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Orson Zhai,
	Baolin Wang, Chunyan Zhang, Alain Volmat, Raphael Gallais-Pou,
	Yannick Fertre, Raphael Gallais-Pou, Philippe Cornu,
	Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet
  Cc: linux-aspeed, dri-devel, linux-arm-kernel, linux-kernel,
	linux-mediatek, imx, linux-stm32, linux-tegra, linux-doc, CK Hu

Il 25/02/25 23:20, Anusha Srivatsa ha scritto:
> Replace platform_get_resource + devm_ioremap_resource
> with just devm_platform_ioremap_resource()
> 
> Used Coccinelle to do this change. SmPl patch:
> @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);
> 
> Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Reviewed-by: Maxime Ripard <mripard@kernel.org>
> Reviewed-by: CK Hu <ck.hu@mediatek.com>
> Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>



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

* Re: (subset) [PATCH RESEND 01/12] drm/aspeed: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 ` [PATCH RESEND 01/12] drm/aspeed: move to devm_platform_ioremap_resource() usage Anusha Srivatsa
@ 2025-02-26 14:47   ` Maxime Ripard
  0 siblings, 0 replies; 24+ messages in thread
From: Maxime Ripard @ 2025-02-26 14:47 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Simona Vetter, Andrew Jeffery, Stefan Agner, Alison Wang,
	Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal, Yongqin Liu,
	John Stultz, Chun-Kuang Hu, Philipp Zabel, Matthias Brugger,
	AngeloGioacchino Del Regno, Marek Vasut, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Alain Volmat, Raphael Gallais-Pou, Yannick Fertre,
	Raphael Gallais-Pou, Philippe Cornu, Maxime Coquelin,
	Alexandre Torgue, Thierry Reding, Mikko Perttunen,
	Jonathan Hunter, Alexey Brodkin, Dave Stevenson, Maíra Canal,
	Raspberry Pi Kernel Maintenance, Jonathan Corbet, Anusha Srivatsa
  Cc: Maxime Ripard, linux-aspeed, dri-devel, linux-arm-kernel,
	linux-kernel, linux-mediatek, imx, linux-stm32, linux-tegra,
	linux-doc

On Tue, 25 Feb 2025 17:20:42 -0500, Anusha Srivatsa wrote:
> Replace platform_get_resource + devm_ioremap_resource
> with just devm_platform_ioremap_resource()
> 
> Used Coccinelle to do this change. SmPl patch:
> @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);
> 
> [...]

Applied to misc/kernel.git (drm-misc-next).

Thanks!
Maxime

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

* Re: (subset) [PATCH RESEND 04/12] drm/mediatek: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 ` [PATCH RESEND 04/12] drm/mediatek: " Anusha Srivatsa
  2025-02-26 12:39   ` AngeloGioacchino Del Regno
@ 2025-02-26 14:47   ` Maxime Ripard
  1 sibling, 0 replies; 24+ messages in thread
From: Maxime Ripard @ 2025-02-26 14:47 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Simona Vetter, Andrew Jeffery, Stefan Agner, Alison Wang,
	Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal, Yongqin Liu,
	John Stultz, Chun-Kuang Hu, Philipp Zabel, Matthias Brugger,
	AngeloGioacchino Del Regno, Marek Vasut, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Alain Volmat, Raphael Gallais-Pou, Yannick Fertre,
	Raphael Gallais-Pou, Philippe Cornu, Maxime Coquelin,
	Alexandre Torgue, Thierry Reding, Mikko Perttunen,
	Jonathan Hunter, Alexey Brodkin, Dave Stevenson, Maíra Canal,
	Raspberry Pi Kernel Maintenance, Jonathan Corbet, Anusha Srivatsa
  Cc: Maxime Ripard, linux-aspeed, dri-devel, linux-arm-kernel,
	linux-kernel, linux-mediatek, imx, linux-stm32, linux-tegra,
	linux-doc, CK Hu

On Tue, 25 Feb 2025 17:20:45 -0500, Anusha Srivatsa wrote:
> Replace platform_get_resource + devm_ioremap_resource
> with just devm_platform_ioremap_resource()
> 
> Used Coccinelle to do this change. SmPl patch:
> @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);
> 
> [...]

Applied to misc/kernel.git (drm-misc-next).

Thanks!
Maxime

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

* Re: (subset) [PATCH RESEND 08/12] drm/stm: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 ` [PATCH RESEND 08/12] drm/stm: " Anusha Srivatsa
@ 2025-02-26 14:47   ` Maxime Ripard
  0 siblings, 0 replies; 24+ messages in thread
From: Maxime Ripard @ 2025-02-26 14:47 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Simona Vetter, Andrew Jeffery, Stefan Agner, Alison Wang,
	Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal, Yongqin Liu,
	John Stultz, Chun-Kuang Hu, Philipp Zabel, Matthias Brugger,
	AngeloGioacchino Del Regno, Marek Vasut, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Alain Volmat, Raphael Gallais-Pou, Yannick Fertre,
	Raphael Gallais-Pou, Philippe Cornu, Maxime Coquelin,
	Alexandre Torgue, Thierry Reding, Mikko Perttunen,
	Jonathan Hunter, Alexey Brodkin, Dave Stevenson, Maíra Canal,
	Raspberry Pi Kernel Maintenance, Jonathan Corbet, Anusha Srivatsa
  Cc: Maxime Ripard, linux-aspeed, dri-devel, linux-arm-kernel,
	linux-kernel, linux-mediatek, imx, linux-stm32, linux-tegra,
	linux-doc

On Tue, 25 Feb 2025 17:20:49 -0500, Anusha Srivatsa wrote:
> Replace platform_get_resource + devm_ioremap_resource
> with just devm_platform_ioremap_resource()
> 
> Used Coccinelle to do this change. SmPl patch:
> @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);
> 
> [...]

Applied to misc/kernel.git (drm-misc-next).

Thanks!
Maxime

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

* Re: (subset) [PATCH RESEND 10/12] drm/tiny: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 ` [PATCH RESEND 10/12] drm/tiny: " Anusha Srivatsa
@ 2025-02-26 14:47   ` Maxime Ripard
  0 siblings, 0 replies; 24+ messages in thread
From: Maxime Ripard @ 2025-02-26 14:47 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Simona Vetter, Andrew Jeffery, Stefan Agner, Alison Wang,
	Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal, Yongqin Liu,
	John Stultz, Chun-Kuang Hu, Philipp Zabel, Matthias Brugger,
	AngeloGioacchino Del Regno, Marek Vasut, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Alain Volmat, Raphael Gallais-Pou, Yannick Fertre,
	Raphael Gallais-Pou, Philippe Cornu, Maxime Coquelin,
	Alexandre Torgue, Thierry Reding, Mikko Perttunen,
	Jonathan Hunter, Alexey Brodkin, Dave Stevenson, Maíra Canal,
	Raspberry Pi Kernel Maintenance, Jonathan Corbet, Anusha Srivatsa
  Cc: Maxime Ripard, linux-aspeed, dri-devel, linux-arm-kernel,
	linux-kernel, linux-mediatek, imx, linux-stm32, linux-tegra,
	linux-doc

On Tue, 25 Feb 2025 17:20:51 -0500, Anusha Srivatsa wrote:
> Replace platform_get_resource + devm_ioremap_resource
> with just devm_platform_ioremap_resource()
> 
> Used Coccinelle to do this change. SmPl patch:
> @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);
> 
> [...]

Applied to misc/kernel.git (drm-misc-next).

Thanks!
Maxime

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

* Re: (subset) [PATCH RESEND 11/12] drm/vc4: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 ` [PATCH RESEND 11/12] drm/vc4: " Anusha Srivatsa
@ 2025-02-26 14:47   ` Maxime Ripard
  0 siblings, 0 replies; 24+ messages in thread
From: Maxime Ripard @ 2025-02-26 14:47 UTC (permalink / raw)
  To: Joel Stanley, Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Simona Vetter, Andrew Jeffery, Stefan Agner, Alison Wang,
	Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal, Yongqin Liu,
	John Stultz, Chun-Kuang Hu, Philipp Zabel, Matthias Brugger,
	AngeloGioacchino Del Regno, Marek Vasut, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Alain Volmat, Raphael Gallais-Pou, Yannick Fertre,
	Raphael Gallais-Pou, Philippe Cornu, Maxime Coquelin,
	Alexandre Torgue, Thierry Reding, Mikko Perttunen,
	Jonathan Hunter, Alexey Brodkin, Dave Stevenson, Maíra Canal,
	Raspberry Pi Kernel Maintenance, Jonathan Corbet, Anusha Srivatsa
  Cc: Maxime Ripard, linux-aspeed, dri-devel, linux-arm-kernel,
	linux-kernel, linux-mediatek, imx, linux-stm32, linux-tegra,
	linux-doc

On Tue, 25 Feb 2025 17:20:52 -0500, Anusha Srivatsa wrote:
> 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);
> ...+>
> 
> [...]

Applied to misc/kernel.git (drm-misc-next).

Thanks!
Maxime

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

* Re: [PATCH RESEND 06/12] drm/sprd: move to devm_platform_ioremap_resource() usage
  2025-02-25 22:20 ` [PATCH RESEND 06/12] drm/sprd: " Anusha Srivatsa
@ 2025-02-27  1:52   ` Chunyan Zhang
  0 siblings, 0 replies; 24+ messages in thread
From: Chunyan Zhang @ 2025-02-27  1:52 UTC (permalink / raw)
  To: Anusha Srivatsa
  Cc: Joel Stanley, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Alain Volmat, Raphael Gallais-Pou,
	Yannick Fertre, Raphael Gallais-Pou, Philippe Cornu,
	Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet, linux-aspeed, dri-devel, linux-arm-kernel,
	linux-kernel, linux-mediatek, imx, linux-stm32, linux-tegra,
	linux-doc, Dmitry Baryshkov

On Wed, 26 Feb 2025 at 06:22, Anusha Srivatsa <asrivats@redhat.com> wrote:
>
> Replace platform_get_resource + devm_ioremap
> with just devm_platform_ioremap_resource()
>
> Used Coccinelle to do this change. SmPl patch:
> @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);
>
> Cc: Chunyan Zhang <zhang.lyra@gmail.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Reviewed-by: Maxime Ripard <mripard@kernel.org>
> Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>

Reviewed-by: Chunyan Zhang <zhang.lyra@gmail.com>

> ---
>  drivers/gpu/drm/sprd/sprd_dpu.c | 9 +--------
>  drivers/gpu/drm/sprd/sprd_dsi.c | 9 +--------
>  2 files changed, 2 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dpu.c
> index cb2816985305fd19eac27413c214681a5a1e9ffa..65cd5aa1634eee5a6735ccffa4ee3979844d92ce 100644
> --- a/drivers/gpu/drm/sprd/sprd_dpu.c
> +++ b/drivers/gpu/drm/sprd/sprd_dpu.c
> @@ -784,16 +784,9 @@ static int sprd_dpu_context_init(struct sprd_dpu *dpu,
>  {
>         struct platform_device *pdev = to_platform_device(dev);
>         struct dpu_context *ctx = &dpu->ctx;
> -       struct resource *res;
>         int ret;
>
> -       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -       if (!res) {
> -               dev_err(dev, "failed to get I/O resource\n");
> -               return -EINVAL;
> -       }
> -
> -       ctx->base = devm_ioremap(dev, res->start, resource_size(res));
> +       ctx->base = devm_platform_ioremap_resource(pdev, 0);
>         if (!ctx->base) {
>                 dev_err(dev, "failed to map dpu registers\n");
>                 return -EFAULT;
> diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_dsi.c
> index 8fc26479bb6bce0aa94914f49d0986a7e19326c1..1668bb4166ab0ad3812c5654244544a9caf249a6 100644
> --- a/drivers/gpu/drm/sprd/sprd_dsi.c
> +++ b/drivers/gpu/drm/sprd/sprd_dsi.c
> @@ -901,15 +901,8 @@ static int sprd_dsi_context_init(struct sprd_dsi *dsi,
>  {
>         struct platform_device *pdev = to_platform_device(dev);
>         struct dsi_context *ctx = &dsi->ctx;
> -       struct resource *res;
>
> -       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -       if (!res) {
> -               dev_err(dev, "failed to get I/O resource\n");
> -               return -EINVAL;
> -       }
> -
> -       ctx->base = devm_ioremap(dev, res->start, resource_size(res));
> +       ctx->base = devm_platform_ioremap_resource(pdev, 0);
>         if (!ctx->base) {
>                 drm_err(dsi->drm, "failed to map dsi host registers\n");
>                 return -ENXIO;
>
> --
> 2.48.1
>

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

* Re: [PATCH RESEND 07/12] drm/sti: move to devm_platform_ioremap_resource() usage
       [not found]     ` <CAN9Xe3Q8=_Tz51i6gxNM6445p-rhNiK7B5Ljcga8g_Nn676dCQ@mail.gmail.com>
@ 2025-03-04  8:04       ` Maxime Ripard
  2025-03-05  8:47       ` Raphael Gallais-Pou
  1 sibling, 0 replies; 24+ messages in thread
From: Maxime Ripard @ 2025-03-04  8:04 UTC (permalink / raw)
  To: Anusha Srivatsa
  Cc: Raphael Gallais-Pou, Joel Stanley, Maarten Lankhorst,
	Thomas Zimmermann, David Airlie, Simona Vetter, Andrew Jeffery,
	Stefan Agner, Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong,
	Sumit Semwal, Yongqin Liu, John Stultz, Chun-Kuang Hu,
	Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
	Marek Vasut, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Alain Volmat, Raphael Gallais-Pou, Yannick Fertre, Philippe Cornu,
	Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet, linux-aspeed, dri-devel, linux-arm-kernel,
	linux-kernel, linux-mediatek, imx, linux-stm32, linux-tegra,
	linux-doc

[-- Attachment #1: Type: text/plain, Size: 2364 bytes --]

On Mon, Mar 03, 2025 at 12:29:19PM -0500, Anusha Srivatsa wrote:
> On Wed, Feb 26, 2025 at 5:19 AM Raphael Gallais-Pou <
> raphael.gallais-pou@foss.st.com> wrote:
> 
> >
> > On 2/25/25 23:20, 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@
> > > 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);
> > >
> > > and
> > > @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);
> > >
> > > v2: Fix compilation error.
> >
> >
> > Hi Anusha,
> >
> >
> > You did not take into account my comment regarding the changelog. :-)
> >
> > https://www.kernel.org/doc/html/latest/process/submitting-patches.html#commentary
> >
> > While the commit summary do not specify the version, this changelog
> > suggests
> > that the version of your series as been incremented.
> > If this is a v2, then a version descriptor should be applied to the
> > patchset.
> >
> > https://www.kernel.org/doc/html/latest/process/submitting-patches.html#subject-line
> >
> > Hi  Raphael,
> 
> That is correct. While this patch is a v2, there is another patch or two in
> the same series that is on v4 when it got acked and reviewed. Having
> patches belonging to the same series with different version prefixes seemed
> odd when I sent the series. Hence added what exactly changed in the commit
> log.

This breaks a lot of tools though. If your series changes, you need to
increase the version number, no matter how small or insignificant it
changed compared to the previous one. resend is only meant to be used
when you send the exact same series.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

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

* Re: [PATCH RESEND 07/12] drm/sti: move to devm_platform_ioremap_resource() usage
       [not found]     ` <CAN9Xe3Q8=_Tz51i6gxNM6445p-rhNiK7B5Ljcga8g_Nn676dCQ@mail.gmail.com>
  2025-03-04  8:04       ` Maxime Ripard
@ 2025-03-05  8:47       ` Raphael Gallais-Pou
  1 sibling, 0 replies; 24+ messages in thread
From: Raphael Gallais-Pou @ 2025-03-05  8:47 UTC (permalink / raw)
  To: Anusha Srivatsa
  Cc: Joel Stanley, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Andrew Jeffery, Stefan Agner,
	Alison Wang, Xinliang Liu, Tian Tao, Xinwei Kong, Sumit Semwal,
	Yongqin Liu, John Stultz, Chun-Kuang Hu, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno, Marek Vasut,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Alain Volmat,
	Raphael Gallais-Pou, Yannick Fertre, Philippe Cornu,
	Maxime Coquelin, Alexandre Torgue, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Alexey Brodkin, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Jonathan Corbet, linux-aspeed, dri-devel, linux-arm-kernel,
	linux-kernel, linux-mediatek, imx, linux-stm32, linux-tegra,
	linux-doc


On 3/3/25 18:29, Anusha Srivatsa wrote:
> On Wed, Feb 26, 2025 at 5:19 AM Raphael Gallais-Pou <
> raphael.gallais-pou@foss.st.com> wrote:
>
>> On 2/25/25 23:20, 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@
>>> 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);
>>>
>>> and
>>> @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);
>>>
>>> v2: Fix compilation error.
>>
>> Hi Anusha,
>>
>>
>> You did not take into account my comment regarding the changelog. :-)
>>
>> https://www.kernel.org/doc/html/latest/process/submitting-patches.html#commentary
>>
>> While the commit summary do not specify the version, this changelog
>> suggests
>> that the version of your series as been incremented.
>> If this is a v2, then a version descriptor should be applied to the
>> patchset.
>>
>> https://www.kernel.org/doc/html/latest/process/submitting-patches.html#subject-line
>>
>> Hi  Raphael,
> That is correct. While this patch is a v2, there is another patch or two in
> the same series that is on v4 when it got acked and reviewed. Having
> patches belonging to the same series with different version prefixes seemed
> odd when I sent the series. Hence added what exactly changed in the commit
> log.


Indeed, the serie version should remain consistent across all patches.

Maxime told you in an earlier answer, any modification of any patch what so ever
increases the serie version. Thus all patches are at v5 (looking at your latest
revision).

Verbatim from the documentation :

Other comments relevant only to the moment or the maintainer, not suitable for
the permanent changelog, should also go here [under the --- marker]. A good
example of such comments might be patch changelogs which describe what has
changed between the v1 and v2 version of the patch.

Please put this information after the --- line which separates the changelog
from the rest of the patch. The version information is not part of the changelog
which gets committed to the git tree. It is additional information for the
reviewers. If it’s placed above the commit tags, it needs manual interaction to
remove it. If it is below the separator line, it gets automatically stripped off
when applying the patch:

https://www.kernel.org/doc/html/latest/process/submitting-patches.html#commentary

Raphaël

>
> Anusha
>
>
>> Regards,
>> Raphaël
>>
>>> Cc: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
>>> Cc: Alain Volmat <alain.volmat@foss.st.com>
>>> Reviewed-by: Maxime Ripard <mripard@kernel.org>
>>> Acked-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
>>> Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
>>> ---
>>>  drivers/gpu/drm/sti/sti_compositor.c | 10 +---------
>>>  drivers/gpu/drm/sti/sti_dvo.c        | 10 +---------
>>>  drivers/gpu/drm/sti/sti_hda.c        |  9 +--------
>>>  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 +---------
>>>  7 files changed, 7 insertions(+), 63 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/sti/sti_compositor.c
>> b/drivers/gpu/drm/sti/sti_compositor.c
>>> index
>> 063f82d23d80c4ba83624a0066a18416a2b37351..7aefce6706ba2cd7d97a33228c9b9812edecf06f
>> 100644
>>> --- a/drivers/gpu/drm/sti/sti_compositor.c
>>> +++ b/drivers/gpu/drm/sti/sti_compositor.c
>>> @@ -177,7 +177,6 @@ static int sti_compositor_probe(struct
>> platform_device *pdev)
>>>       struct device_node *np = dev->of_node;
>>>       struct device_node *vtg_np;
>>>       struct sti_compositor *compo;
>>> -     struct resource *res;
>>>       unsigned int i;
>>>
>>>       compo = devm_kzalloc(dev, sizeof(*compo), GFP_KERNEL);
>>> @@ -194,14 +193,7 @@ static int sti_compositor_probe(struct
>> platform_device *pdev)
>>>       memcpy(&compo->data, of_match_node(compositor_of_match, np)->data,
>>>              sizeof(struct sti_compositor_data));
>>> -
>>> -     /* Get Memory ressources */
>>> -     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> -     if (res == NULL) {
>>> -             DRM_ERROR("Get memory resource failed\n");
>>> -             return -ENXIO;
>>> -     }
>>> -     compo->regs = devm_ioremap(dev, res->start, resource_size(res));
>>> +     compo->regs = devm_platform_ioremap_resource(pdev, 0);
>>>       if (compo->regs == NULL) {
>>>               DRM_ERROR("Register mapping failed\n");
>>>               return -ENXIO;
>>> diff --git a/drivers/gpu/drm/sti/sti_dvo.c
>> b/drivers/gpu/drm/sti/sti_dvo.c
>>> index
>> 4dcddd02629b6a1052be8fb8333bd3aa17c083c5..c877298a7f2bad171724eca4d43ea622db4c81cd
>> 100644
>>> --- a/drivers/gpu/drm/sti/sti_dvo.c
>>> +++ b/drivers/gpu/drm/sti/sti_dvo.c
>>> @@ -511,7 +511,6 @@ static int sti_dvo_probe(struct platform_device
>> *pdev)
>>>  {
>>>       struct device *dev = &pdev->dev;
>>>       struct sti_dvo *dvo;
>>> -     struct resource *res;
>>>       struct device_node *np = dev->of_node;
>>>
>>>       DRM_INFO("%s\n", __func__);
>>> @@ -523,14 +522,7 @@ static int sti_dvo_probe(struct platform_device
>> *pdev)
>>>       }
>>>
>>>       dvo->dev = pdev->dev;
>>> -
>>> -     res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
>> "dvo-reg");
>>> -     if (!res) {
>>> -             DRM_ERROR("Invalid dvo resource\n");
>>> -             return -ENOMEM;
>>> -     }
>>> -     dvo->regs = devm_ioremap(dev, res->start,
>>> -                     resource_size(res));
>>> +     dvo->regs = devm_platform_ioremap_resource_byname(pdev, "dvo-reg");
>>>       if (!dvo->regs)
>>>               return -ENOMEM;
>>>
>>> diff --git a/drivers/gpu/drm/sti/sti_hda.c
>> b/drivers/gpu/drm/sti/sti_hda.c
>>> index
>> 14fdc00d2ba03d4f96ba407ac8e576decb6f32c0..3ca3abb80d425901f4c031edfd327a770d624e1c
>> 100644
>>> --- a/drivers/gpu/drm/sti/sti_hda.c
>>> +++ b/drivers/gpu/drm/sti/sti_hda.c
>>> @@ -750,14 +750,7 @@ static int sti_hda_probe(struct platform_device
>> *pdev)
>>>               return -ENOMEM;
>>>
>>>       hda->dev = pdev->dev;
>>> -
>>> -     /* Get resources */
>>> -     res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
>> "hda-reg");
>>> -     if (!res) {
>>> -             DRM_ERROR("Invalid hda resource\n");
>>> -             return -ENOMEM;
>>> -     }
>>> -     hda->regs = devm_ioremap(dev, res->start, resource_size(res));
>>> +     hda->regs = devm_platform_ioremap_resource_byname(pdev, "hda-reg");
>>>       if (!hda->regs)
>>>               return -ENOMEM;
>>>
>>> diff --git a/drivers/gpu/drm/sti/sti_hdmi.c
>> b/drivers/gpu/drm/sti/sti_hdmi.c
>>> index
>> 164a34d793d86f114394048667ae3189e1c39242..c64ce7a1ef58b9ce4429edd368269bea87d86984
>> 100644
>>> --- a/drivers/gpu/drm/sti/sti_hdmi.c
>>> +++ b/drivers/gpu/drm/sti/sti_hdmi.c
>>> @@ -1380,7 +1380,6 @@ static int sti_hdmi_probe(struct platform_device
>> *pdev)
>>>       struct device *dev = &pdev->dev;
>>>       struct sti_hdmi *hdmi;
>>>       struct device_node *np = dev->of_node;
>>> -     struct resource *res;
>>>       struct device_node *ddc;
>>>       int ret;
>>>
>>> @@ -1399,15 +1398,7 @@ static int sti_hdmi_probe(struct platform_device
>> *pdev)
>>>       }
>>>
>>>       hdmi->dev = pdev->dev;
>>> -
>>> -     /* Get resources */
>>> -     res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
>> "hdmi-reg");
>>> -     if (!res) {
>>> -             DRM_ERROR("Invalid hdmi resource\n");
>>> -             ret = -ENOMEM;
>>> -             goto release_adapter;
>>> -     }
>>> -     hdmi->regs = devm_ioremap(dev, res->start, resource_size(res));
>>> +     hdmi->regs = devm_platform_ioremap_resource_byname(pdev,
>> "hdmi-reg");
>>>       if (!hdmi->regs) {
>>>               ret = -ENOMEM;
>>>               goto release_adapter;
>>> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c
>> b/drivers/gpu/drm/sti/sti_hqvdp.c
>>> index
>> 0f658709c9d0d398c4eed65202443db9d0b41f8c..420395598d119a403d531211022e6005d6a2bd59
>> 100644
>>> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
>>> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
>>> @@ -1356,7 +1356,6 @@ static int sti_hqvdp_probe(struct platform_device
>> *pdev)
>>>       struct device *dev = &pdev->dev;
>>>       struct device_node *vtg_np;
>>>       struct sti_hqvdp *hqvdp;
>>> -     struct resource *res;
>>>
>>>       DRM_DEBUG_DRIVER("\n");
>>>
>>> @@ -1367,14 +1366,7 @@ static int sti_hqvdp_probe(struct platform_device
>> *pdev)
>>>       }
>>>
>>>       hqvdp->dev = dev;
>>> -
>>> -     /* Get Memory resources */
>>> -     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> -     if (!res) {
>>> -             DRM_ERROR("Get memory resource failed\n");
>>> -             return -ENXIO;
>>> -     }
>>> -     hqvdp->regs = devm_ioremap(dev, res->start, resource_size(res));
>>> +     hqvdp->regs = devm_platform_ioremap_resource(pdev, 0);
>>>       if (!hqvdp->regs) {
>>>               DRM_ERROR("Register mapping failed\n");
>>>               return -ENXIO;
>>> diff --git a/drivers/gpu/drm/sti/sti_tvout.c
>> b/drivers/gpu/drm/sti/sti_tvout.c
>>> index
>> af6c06f448c4819def8cc0d0836e30f991529690..0bebe815f5e7567f84388af93723a6fa7d2cc7a2
>> 100644
>>> --- a/drivers/gpu/drm/sti/sti_tvout.c
>>> +++ b/drivers/gpu/drm/sti/sti_tvout.c
>>> @@ -838,7 +838,6 @@ static int sti_tvout_probe(struct platform_device
>> *pdev)
>>>       struct device *dev = &pdev->dev;
>>>       struct device_node *node = dev->of_node;
>>>       struct sti_tvout *tvout;
>>> -     struct resource *res;
>>>
>>>       DRM_INFO("%s\n", __func__);
>>>
>>> @@ -850,14 +849,7 @@ static int sti_tvout_probe(struct platform_device
>> *pdev)
>>>               return -ENOMEM;
>>>
>>>       tvout->dev = dev;
>>> -
>>> -     /* get memory resources */
>>> -     res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
>> "tvout-reg");
>>> -     if (!res) {
>>> -             DRM_ERROR("Invalid glue resource\n");
>>> -             return -ENOMEM;
>>> -     }
>>> -     tvout->regs = devm_ioremap(dev, res->start, resource_size(res));
>>> +     tvout->regs = devm_platform_ioremap_resource_byname(pdev,
>> "tvout-reg");
>>>       if (!tvout->regs)
>>>               return -ENOMEM;
>>>
>>> diff --git a/drivers/gpu/drm/sti/sti_vtg.c
>> b/drivers/gpu/drm/sti/sti_vtg.c
>>> index
>> 5ba469b711b5318e9e9e6d8df127fb8933d1fac1..b5353fe774d72fd629ecd3ef75a5d2817ca8617f
>> 100644
>>> --- a/drivers/gpu/drm/sti/sti_vtg.c
>>> +++ b/drivers/gpu/drm/sti/sti_vtg.c
>>> @@ -380,20 +380,12 @@ static int vtg_probe(struct platform_device *pdev)
>>>  {
>>>       struct device *dev = &pdev->dev;
>>>       struct sti_vtg *vtg;
>>> -     struct resource *res;
>>>       int ret;
>>>
>>>       vtg = devm_kzalloc(dev, sizeof(*vtg), GFP_KERNEL);
>>>       if (!vtg)
>>>               return -ENOMEM;
>>> -
>>> -     /* Get Memory ressources */
>>> -     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> -     if (!res) {
>>> -             DRM_ERROR("Get memory resource failed\n");
>>> -             return -ENOMEM;
>>> -     }
>>> -     vtg->regs = devm_ioremap(dev, res->start, resource_size(res));
>>> +     vtg->regs = devm_platform_ioremap_resource(pdev, 0);
>>>       if (!vtg->regs) {
>>>               DRM_ERROR("failed to remap I/O memory\n");
>>>               return -ENOMEM;
>>>
>>

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

end of thread, other threads:[~2025-03-05  9:00 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-25 22:20 [PATCH RESEND 00/12] drm: Move to using devm_platform_ioremap_resource Anusha Srivatsa
2025-02-25 22:20 ` [PATCH RESEND 01/12] drm/aspeed: move to devm_platform_ioremap_resource() usage Anusha Srivatsa
2025-02-26 14:47   ` (subset) " Maxime Ripard
2025-02-25 22:20 ` [PATCH RESEND 02/12] drm/fsl-dcu: " Anusha Srivatsa
2025-02-25 22:20 ` [PATCH RESEND 03/12] drm/hisilicon: " Anusha Srivatsa
2025-02-25 22:20 ` [PATCH RESEND 04/12] drm/mediatek: " Anusha Srivatsa
2025-02-26 12:39   ` AngeloGioacchino Del Regno
2025-02-26 14:47   ` (subset) " Maxime Ripard
2025-02-25 22:20 ` [PATCH RESEND 05/12] drm/mxsfb: " Anusha Srivatsa
2025-02-25 22:20 ` [PATCH RESEND 06/12] drm/sprd: " Anusha Srivatsa
2025-02-27  1:52   ` Chunyan Zhang
2025-02-25 22:20 ` [PATCH RESEND 07/12] drm/sti: " Anusha Srivatsa
2025-02-26  9:06   ` Raphael Gallais-Pou
     [not found]     ` <CAN9Xe3Q8=_Tz51i6gxNM6445p-rhNiK7B5Ljcga8g_Nn676dCQ@mail.gmail.com>
2025-03-04  8:04       ` Maxime Ripard
2025-03-05  8:47       ` Raphael Gallais-Pou
2025-02-25 22:20 ` [PATCH RESEND 08/12] drm/stm: " Anusha Srivatsa
2025-02-26 14:47   ` (subset) " Maxime Ripard
2025-02-25 22:20 ` [PATCH RESEND 09/12] drm/tegra: " Anusha Srivatsa
2025-02-25 22:20 ` [PATCH RESEND 10/12] drm/tiny: " Anusha Srivatsa
2025-02-26 14:47   ` (subset) " Maxime Ripard
2025-02-25 22:20 ` [PATCH RESEND 11/12] drm/vc4: " Anusha Srivatsa
2025-02-26 14:47   ` (subset) " Maxime Ripard
2025-02-25 22:20 ` [PATCH RESEND 12/12] Documentation: Update the todo Anusha Srivatsa
2025-02-26 10:21   ` Thomas Zimmermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).