dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/tegra: dsi: Use devm_platform_get_and_ioremap_resource() in tegra_dsi_probe()
@ 2024-02-05 10:01 Markus Elfring
  2024-02-06 19:30 ` [PATCH v2] drm/tegra: dsi: Use devm_platform_ioremap_resource() " Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2024-02-05 10:01 UTC (permalink / raw)
  To: linux-tegra, dri-devel, kernel-janitors, Daniel Vetter,
	David Airlie, Jonathan Hunter, Mikko Perttunen, Thierry Reding
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 5 Feb 2024 10:51:36 +0100

A wrapper function is available since the commit 890cc39a879906b63912482dfc41944579df2dc6
("drivers: provide devm_platform_get_and_ioremap_resource()").
Thus reuse existing functionality instead of keeping duplicate source code.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/gpu/drm/tegra/dsi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index fbfe92a816d4..727c3a7d8d26 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -1624,8 +1624,7 @@ static int tegra_dsi_probe(struct platform_device *pdev)
 		return err;
 	}

-	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	dsi->regs = devm_ioremap_resource(&pdev->dev, regs);
+	dsi->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &regs);
 	if (IS_ERR(dsi->regs))
 		return PTR_ERR(dsi->regs);

--
2.43.0


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

* [PATCH v2] drm/tegra: dsi: Use devm_platform_ioremap_resource() in tegra_dsi_probe()
  2024-02-05 10:01 [PATCH] drm/tegra: dsi: Use devm_platform_get_and_ioremap_resource() in tegra_dsi_probe() Markus Elfring
@ 2024-02-06 19:30 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2024-02-06 19:30 UTC (permalink / raw)
  To: linux-tegra, dri-devel, kernel-janitors, Daniel Vetter,
	David Airlie, Jonathan Hunter, Mikko Perttunen, Thierry Reding
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 6 Feb 2024 20:22:56 +0100

A wrapper function is available since the commit 7945f929f1a77a1c8887a97ca07f87626858ff42
("drivers: provide devm_platform_ioremap_resource()").

* Thus reuse existing functionality instead of keeping duplicate source code.

* Delete a local variable which became unnecessary with this refactoring.


This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---

v2:
The transformation pattern was adjusted based on advices by known contributors.

Examples:
* Douglas Anderson
* Geert Uytterhoeven
* Robin Murphy


 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 fbfe92a816d4..f9b6b5428b66 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -1562,7 +1562,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);
@@ -1624,8 +1623,7 @@ static int tegra_dsi_probe(struct platform_device *pdev)
 		return err;
 	}

-	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))
 		return PTR_ERR(dsi->regs);

--
2.43.0


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

end of thread, other threads:[~2024-02-06 19:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-05 10:01 [PATCH] drm/tegra: dsi: Use devm_platform_get_and_ioremap_resource() in tegra_dsi_probe() Markus Elfring
2024-02-06 19:30 ` [PATCH v2] drm/tegra: dsi: Use devm_platform_ioremap_resource() " Markus Elfring

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).