* [PATCH] PCI: tegra: replace devm_request_and_ioremap by devm_ioremap_resource
@ 2013-08-26 9:11 Thierry Reding
[not found] ` <1377508269-9664-1-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Thierry Reding @ 2013-08-26 9:11 UTC (permalink / raw)
To: arm-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Julia Lawall,
Thierry Reding
From: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
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-L2FTfq7BK8M@public.gmane.org>
Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Tested-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Acked-by: Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Acked-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
Hi,
This is a small cleanup patch on top of the recently merged Tegra PCIe
driver. Can someone please apply this to the same branch that Tegra's
tegra-for-3.12-soc branch was merged? I think Kevin Hilman pulled it
into next/soc.
Thanks,
Thierry
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);
}
--
1.8.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI: tegra: replace devm_request_and_ioremap by devm_ioremap_resource
[not found] ` <1377508269-9664-1-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2013-08-29 20:02 ` Olof Johansson
0 siblings, 0 replies; 2+ messages in thread
From: Olof Johansson @ 2013-08-29 20:02 UTC (permalink / raw)
To: Thierry Reding
Cc: arm-DgEjT+Ai2ygdnm+yROfE0A, linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Julia Lawall,
Thierry Reding
On Mon, Aug 26, 2013 at 11:11:09AM +0200, Thierry Reding wrote:
> From: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
>
> 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-L2FTfq7BK8M@public.gmane.org>
> Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> Tested-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> Acked-by: Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> Acked-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
> Hi,
>
> This is a small cleanup patch on top of the recently merged Tegra PCIe
> driver. Can someone please apply this to the same branch that Tegra's
> tegra-for-3.12-soc branch was merged? I think Kevin Hilman pulled it
> into next/soc.
Applied.
-Olof
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-29 20:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-26 9:11 [PATCH] PCI: tegra: replace devm_request_and_ioremap by devm_ioremap_resource Thierry Reding
[not found] ` <1377508269-9664-1-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-08-29 20:02 ` Olof Johansson
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).