public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: "Robin Murphy" <robin.murphy@arm.com>,
	iommu@lists.linux.dev, kernel-janitors@vger.kernel.org,
	"Jörg Rödel" <joro@8bytes.org>, "Will Deacon" <will@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH v2] iommu/ipmmu-vmsa: Use devm_platform_ioremap_resource() in ipmmu_probe()
Date: Tue, 6 Feb 2024 15:15:23 +0100	[thread overview]
Message-ID: <596b3bda-3bef-4e28-b9dd-08b96da97097@web.de> (raw)
In-Reply-To: <324d4e02-6a5a-4112-a3a7-d7aeb5876acc@arm.com>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 6 Feb 2024 15:00:23 +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:
* Doug Anderson
* Geert Uytterhoeven
* Robin Murphy


 drivers/iommu/ipmmu-vmsa.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index ace1fc4bd34b..7e28aac1e383 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -1005,7 +1005,6 @@ static const struct of_device_id ipmmu_of_ids[] = {
 static int ipmmu_probe(struct platform_device *pdev)
 {
 	struct ipmmu_vmsa_device *mmu;
-	struct resource *res;
 	int irq;
 	int ret;

@@ -1025,8 +1024,7 @@ static int ipmmu_probe(struct platform_device *pdev)
 		return ret;

 	/* Map I/O memory and request IRQ. */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	mmu->base = devm_ioremap_resource(&pdev->dev, res);
+	mmu->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(mmu->base))
 		return PTR_ERR(mmu->base);

--
2.43.0


  parent reply	other threads:[~2024-02-06 14:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05 10:42 [PATCH] iommu/ipmmu-vmsa: Use devm_platform_get_and_ioremap_resource() in ipmmu_probe() Markus Elfring
2024-02-05 11:11 ` Robin Murphy
2024-02-05 11:52   ` Markus Elfring
2024-02-05 12:34     ` Robin Murphy
2024-02-05 13:02       ` Markus Elfring
2024-02-05 14:00         ` Robin Murphy
2024-02-05 18:29   ` Markus Elfring
2024-02-06 14:15   ` Markus Elfring [this message]
2024-02-07  9:13     ` [PATCH v2] iommu/ipmmu-vmsa: Use devm_platform_ioremap_resource() " Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=596b3bda-3bef-4e28-b9dd-08b96da97097@web.de \
    --to=markus.elfring@web.de \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox