The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Yangtao Li <frank.li@vivo.com>
To: "Linus Walleij" <linus.walleij@linaro.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>
Cc: Yangtao Li <frank.li@vivo.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] PCI: v3-semi: Use devm_platform_get_and_ioremap_resource()
Date: Thu,  6 Jul 2023 17:20:45 +0800	[thread overview]
Message-ID: <20230706092047.18599-3-frank.li@vivo.com> (raw)
In-Reply-To: <20230706092047.18599-1-frank.li@vivo.com>

Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/pci/controller/pci-v3-semi.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/controller/pci-v3-semi.c b/drivers/pci/controller/pci-v3-semi.c
index ca44b0c83d1b..0f993328dba2 100644
--- a/drivers/pci/controller/pci-v3-semi.c
+++ b/drivers/pci/controller/pci-v3-semi.c
@@ -736,8 +736,7 @@ static int v3_pci_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	v3->base = devm_ioremap_resource(dev, regs);
+	v3->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(v3->base))
 		return PTR_ERR(v3->base);
 	/*
@@ -750,15 +749,14 @@ static int v3_pci_probe(struct platform_device *pdev)
 			readl(v3->base + V3_LB_IO_BASE), regs);
 
 	/* Configuration space is 16MB directly mapped */
-	regs = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	v3->config_base = devm_platform_get_and_ioremap_resource(pdev, 1, &res);
+	if (IS_ERR(v3->config_base))
+		return PTR_ERR(v3->config_base);
 	if (resource_size(regs) != SZ_16M) {
 		dev_err(dev, "config mem is not 16MB!\n");
 		return -EINVAL;
 	}
 	v3->config_mem = regs->start;
-	v3->config_base = devm_ioremap_resource(dev, regs);
-	if (IS_ERR(v3->config_base))
-		return PTR_ERR(v3->config_base);
 
 	/* Get and request error IRQ resource */
 	irq = platform_get_irq(pdev, 0);
-- 
2.39.0


  parent reply	other threads:[~2023-07-06  9:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-06  9:20 [PATCH 1/4] PCI: imx6: Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-06  9:20 ` [PATCH 2/4] PCI: rcar-gen2: " Yangtao Li
2023-07-06  9:30   ` Geert Uytterhoeven
2023-07-06  9:20 ` Yangtao Li [this message]
2023-07-06 18:04   ` [PATCH 3/4] PCI: v3-semi: " Linus Walleij
2023-07-06 18:55   ` Krzysztof Wilczyński
2023-07-07  7:39     ` Yangtao Li
2023-07-06  9:20 ` [PATCH 4/4] PCI: xgene-msi: " Yangtao Li

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=20230706092047.18599-3-frank.li@vivo.com \
    --to=frank.li@vivo.com \
    --cc=bhelgaas@google.com \
    --cc=kw@linux.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=robh@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