From: Julia Lawall <julia.lawall@lip6.fr>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
kernel-janitors@vger.kernel.org,
Bjorn Helgaas <bhelgaas@google.com>,
Stephen Warren <swarren@wwwdotorg.org>,
linux-tegra@vger.kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/7] PCI: tegra: replace devm_request_and_ioremap by devm_ioremap_resource
Date: Tue, 20 Aug 2013 11:13:14 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.02.1308201112400.2269@hadrien> (raw)
In-Reply-To: <20130819193339.GB4961@mithrandir>
From: Julia Lawall <Julia.Lawall@lip6.fr>
Use devm_ioremap_resource instead of devm_request_and_ioremap.
This was done using the semantic patch
scripts/coccinelle/api/devm_ioremap_resource.cocci
Error-handling code was manually removed from the associated calls to
platform_get_resource.
Adjust the comment at the third platform_get_resource_byname to make clear
why ioremap is not done at this point.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
Tested-by: Thierry Reding <thierry.reding@gmail.com>
---
v2: add the change to the comment
drivers/pci/host/pci-tegra.c | 31 ++++++++++---------------------
1 file changed, 10 insertions(+), 21 deletions(-)
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 7356741..2e9888a 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -1031,32 +1031,21 @@ static int tegra_pcie_get_resources(struct tegra_pcie *pcie)
return err;
}
- /* request and remap controller registers */
pads = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pads");
- if (!pads) {
- err = -EADDRNOTAVAIL;
+ pcie->pads = devm_ioremap_resource(&pdev->dev, pads);
+ if (IS_ERR(pcie->pads)) {
+ err = PTR_ERR(pcie->pads);
goto poweroff;
}
afi = platform_get_resource_byname(pdev, IORESOURCE_MEM, "afi");
- if (!afi) {
- err = -EADDRNOTAVAIL;
- goto poweroff;
- }
-
- pcie->pads = devm_request_and_ioremap(&pdev->dev, pads);
- if (!pcie->pads) {
- err = -EADDRNOTAVAIL;
- goto poweroff;
- }
-
- pcie->afi = devm_request_and_ioremap(&pdev->dev, afi);
- if (!pcie->afi) {
- err = -EADDRNOTAVAIL;
+ pcie->afi = devm_ioremap_resource(&pdev->dev, afi);
+ if (IS_ERR(pcie->afi)) {
+ err = PTR_ERR(pcie->afi);
goto poweroff;
}
- /* request and remap configuration space */
+ /* request configuration space, but remap later, on demand */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cs");
if (!res) {
err = -EADDRNOTAVAIL;
@@ -1492,9 +1481,9 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
rp->lanes = value;
rp->pcie = pcie;
- rp->base = devm_request_and_ioremap(pcie->dev, &rp->regs);
- if (!rp->base)
- return -EADDRNOTAVAIL;
+ rp->base = devm_ioremap_resource(pcie->dev, &rp->regs);
+ if (IS_ERR(rp->base))
+ return PTR_ERR(rp->base);
list_add_tail(&rp->list, &pcie->ports);
}
next prev parent reply other threads:[~2013-08-20 9:13 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-19 11:20 [PATCH 0/7] replace devm_request_and_ioremap by devm_ioremap_resource Julia Lawall
2013-08-19 11:20 ` [PATCH 1/7] PCI: tegra: " Julia Lawall
2013-08-19 12:02 ` Thierry Reding
2013-08-19 12:07 ` Julia Lawall
2013-08-19 12:12 ` Thierry Reding
2013-08-19 12:15 ` Julia Lawall
2013-08-19 19:33 ` Thierry Reding
2013-08-19 20:56 ` Stephen Warren
2013-08-20 9:13 ` Julia Lawall [this message]
2013-08-20 16:26 ` Bjorn Helgaas
2013-08-20 18:53 ` Stephen Warren
2013-08-20 19:31 ` Thierry Reding
2013-08-19 20:04 ` Bjorn Helgaas
2013-08-19 20:12 ` Thierry Reding
2013-08-19 20:49 ` Bjorn Helgaas
2013-08-27 8:14 ` Thierry Reding
2013-08-27 16:11 ` Stephen Warren
2013-08-27 18:03 ` Bjorn Helgaas
2013-08-28 13:02 ` Bjorn Helgaas
2013-08-28 13:27 ` Thierry Reding
2013-08-28 13:31 ` Thierry Reding
2013-08-19 11:20 ` [PATCH 2/7] serial: st-asc: " Julia Lawall
2013-08-19 11:20 ` [PATCH 3/7] iommu/arm: " Julia Lawall
2013-08-20 11:35 ` Will Deacon
2013-08-20 11:49 ` Julia Lawall
2013-08-19 11:20 ` [PATCH 4/7] dma: " Julia Lawall
2013-09-02 12:07 ` Vinod Koul
2013-08-19 11:20 ` [PATCH 5/7] bcm63xx_enet: " Julia Lawall
2013-08-21 6:22 ` David Miller
2013-08-19 11:20 ` [PATCH 6/7] video: xilinxfb: " Julia Lawall
2013-08-30 9:42 ` Tomi Valkeinen
2013-08-19 11:20 ` [PATCH 7/7] mmc: mvsdio: " Julia Lawall
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=alpine.DEB.2.02.1308201112400.2269@hadrien \
--to=julia.lawall@lip6.fr \
--cc=bhelgaas@google.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=swarren@wwwdotorg.org \
--cc=thierry.reding@gmail.com \
/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