aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/host
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2013-08-26 05:11:09 -0400
committerOlof Johansson <olof@lixom.net>2013-08-29 16:02:16 -0400
commitdc05ee32985585ba1d4c80ea4d904e34a8f92ef4 (patch)
treebfd135df568a0147eac52f82003f88975dc27a58 /drivers/pci/host
parente8a72e2a5d0c65d2f477969cbc594be42644b68f (diff)
PCI: tegra: replace devm_request_and_ioremap by devm_ioremap_resource
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 <treding@nvidia.com> Tested-by: Thierry Reding <treding@nvidia.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/pci/host')
-rw-r--r--drivers/pci/host/pci-tegra.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 7356741de36b..2e9888a0635a 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)
1031 return err; 1031 return err;
1032 } 1032 }
1033 1033
1034 /* request and remap controller registers */
1035 pads = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pads"); 1034 pads = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pads");
1036 if (!pads) { 1035 pcie->pads = devm_ioremap_resource(&pdev->dev, pads);
1037 err = -EADDRNOTAVAIL; 1036 if (IS_ERR(pcie->pads)) {
1037 err = PTR_ERR(pcie->pads);
1038 goto poweroff; 1038 goto poweroff;
1039 } 1039 }
1040 1040
1041 afi = platform_get_resource_byname(pdev, IORESOURCE_MEM, "afi"); 1041 afi = platform_get_resource_byname(pdev, IORESOURCE_MEM, "afi");
1042 if (!afi) { 1042 pcie->afi = devm_ioremap_resource(&pdev->dev, afi);
1043 err = -EADDRNOTAVAIL; 1043 if (IS_ERR(pcie->afi)) {
1044 goto poweroff; 1044 err = PTR_ERR(pcie->afi);
1045 }
1046
1047 pcie->pads = devm_request_and_ioremap(&pdev->dev, pads);
1048 if (!pcie->pads) {
1049 err = -EADDRNOTAVAIL;
1050 goto poweroff;
1051 }
1052
1053 pcie->afi = devm_request_and_ioremap(&pdev->dev, afi);
1054 if (!pcie->afi) {
1055 err = -EADDRNOTAVAIL;
1056 goto poweroff; 1045 goto poweroff;
1057 } 1046 }
1058 1047
1059 /* request and remap configuration space */ 1048 /* request configuration space, but remap later, on demand */
1060 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cs"); 1049 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cs");
1061 if (!res) { 1050 if (!res) {
1062 err = -EADDRNOTAVAIL; 1051 err = -EADDRNOTAVAIL;
@@ -1492,9 +1481,9 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
1492 rp->lanes = value; 1481 rp->lanes = value;
1493 rp->pcie = pcie; 1482 rp->pcie = pcie;
1494 1483
1495 rp->base = devm_request_and_ioremap(pcie->dev, &rp->regs); 1484 rp->base = devm_ioremap_resource(pcie->dev, &rp->regs);
1496 if (!rp->base) 1485 if (IS_ERR(rp->base))
1497 return -EADDRNOTAVAIL; 1486 return PTR_ERR(rp->base);
1498 1487
1499 list_add_tail(&rp->list, &pcie->ports); 1488 list_add_tail(&rp->list, &pcie->ports);
1500 } 1489 }