[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e4585b03-3629-4bd7-a349-f5471ebd8685@web.de>
Date: Tue, 6 Feb 2024 16:40:24 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: sparclinux@...r.kernel.org, kernel-janitors@...r.kernel.org,
Andreas Larsson <andreas@...sler.com>, "David S. Miller"
<davem@...emloft.net>, Rob Herring <robh@...nel.org>,
Sam Ravnborg <sam@...nborg.org>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH v2] sparc: leon: grpci1: Use devm_platform_ioremap_resource()
in grpci1_of_probe()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 6 Feb 2024 16:30:15 +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@...rs.sourceforge.net>
---
v2:
The transformation pattern was adjusted based on advices by known contributors.
Examples:
* Doug Anderson
* Geert Uytterhoeven
* Robin Murphy
arch/sparc/kernel/leon_pci_grpci1.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/sparc/kernel/leon_pci_grpci1.c b/arch/sparc/kernel/leon_pci_grpci1.c
index 8700a0e3b0df..a01ecee18e1e 100644
--- a/arch/sparc/kernel/leon_pci_grpci1.c
+++ b/arch/sparc/kernel/leon_pci_grpci1.c
@@ -516,7 +516,6 @@ static int grpci1_of_probe(struct platform_device *ofdev)
int err, len;
const int *tmp;
u32 cfg, size, err_mask;
- struct resource *res;
if (grpci1priv) {
dev_err(&ofdev->dev, "only one GRPCI1 supported\n");
@@ -537,8 +536,7 @@ static int grpci1_of_probe(struct platform_device *ofdev)
priv->dev = &ofdev->dev;
/* find device register base address */
- res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
- regs = devm_ioremap_resource(&ofdev->dev, res);
+ regs = devm_platform_ioremap_resource(ofdev, 0);
if (IS_ERR(regs))
return PTR_ERR(regs);
--
2.43.0
Powered by blists - more mailing lists