Commit 3cf0eead authored by Dejin Zheng's avatar Dejin Zheng Committed by Lorenzo Pieralisi

PCI: controller: Convert to devm_platform_ioremap_resource()

Use devm_platform_ioremap_resource() to simplify the code, since t
contains platform_get_resource() and devm_ioremap_resource() calls
respectively.

Link: https://lore.kernel.org/r/20200708155614.308-1-zhengdejin5@gmail.comSigned-off-by: default avatarDejin Zheng <zhengdejin5@gmail.com>
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: default avatarRob Herring <robh@kernel.org>
parent e2dcd20b
...@@ -84,14 +84,12 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev, ...@@ -84,14 +84,12 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev,
{ {
struct dw_pcie *pci = ep->pci; struct dw_pcie *pci = ep->pci;
struct device *dev = pci->dev; struct device *dev = pci->dev;
struct resource *res;
ep->mem_res = devm_kzalloc(dev, sizeof(*ep->mem_res), GFP_KERNEL); ep->mem_res = devm_kzalloc(dev, sizeof(*ep->mem_res), GFP_KERNEL);
if (!ep->mem_res) if (!ep->mem_res)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ep->mem_res->elbi_base = devm_platform_ioremap_resource(pdev, 0);
ep->mem_res->elbi_base = devm_ioremap_resource(dev, res);
if (IS_ERR(ep->mem_res->elbi_base)) if (IS_ERR(ep->mem_res->elbi_base))
return PTR_ERR(ep->mem_res->elbi_base); return PTR_ERR(ep->mem_res->elbi_base);
......
...@@ -1105,7 +1105,7 @@ static int advk_pcie_probe(struct platform_device *pdev) ...@@ -1105,7 +1105,7 @@ static int advk_pcie_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct advk_pcie *pcie; struct advk_pcie *pcie;
struct resource *res, *bus; struct resource *bus;
struct pci_host_bridge *bridge; struct pci_host_bridge *bridge;
int ret, irq; int ret, irq;
...@@ -1116,8 +1116,7 @@ static int advk_pcie_probe(struct platform_device *pdev) ...@@ -1116,8 +1116,7 @@ static int advk_pcie_probe(struct platform_device *pdev)
pcie = pci_host_bridge_priv(bridge); pcie = pci_host_bridge_priv(bridge);
pcie->pdev = pdev; pcie->pdev = pdev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pcie->base = devm_platform_ioremap_resource(pdev, 0);
pcie->base = devm_ioremap_resource(dev, res);
if (IS_ERR(pcie->base)) if (IS_ERR(pcie->base))
return PTR_ERR(pcie->base); return PTR_ERR(pcie->base);
......
...@@ -422,7 +422,6 @@ static int faraday_pci_probe(struct platform_device *pdev) ...@@ -422,7 +422,6 @@ static int faraday_pci_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
const struct faraday_pci_variant *variant = const struct faraday_pci_variant *variant =
of_device_get_match_data(dev); of_device_get_match_data(dev);
struct resource *regs;
struct resource_entry *win; struct resource_entry *win;
struct faraday_pci *p; struct faraday_pci *p;
struct resource *io; struct resource *io;
...@@ -465,8 +464,7 @@ static int faraday_pci_probe(struct platform_device *pdev) ...@@ -465,8 +464,7 @@ static int faraday_pci_probe(struct platform_device *pdev)
return ret; return ret;
} }
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); p->base = devm_platform_ioremap_resource(pdev, 0);
p->base = devm_ioremap_resource(dev, regs);
if (IS_ERR(p->base)) if (IS_ERR(p->base))
return PTR_ERR(p->base); return PTR_ERR(p->base);
......
...@@ -76,13 +76,11 @@ static int versatile_pci_probe(struct platform_device *pdev) ...@@ -76,13 +76,11 @@ static int versatile_pci_probe(struct platform_device *pdev)
if (!bridge) if (!bridge)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); versatile_pci_base = devm_platform_ioremap_resource(pdev, 0);
versatile_pci_base = devm_ioremap_resource(dev, res);
if (IS_ERR(versatile_pci_base)) if (IS_ERR(versatile_pci_base))
return PTR_ERR(versatile_pci_base); return PTR_ERR(versatile_pci_base);
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); versatile_cfg_base[0] = devm_platform_ioremap_resource(pdev, 1);
versatile_cfg_base[0] = devm_ioremap_resource(dev, res);
if (IS_ERR(versatile_cfg_base[0])) if (IS_ERR(versatile_cfg_base[0]))
return PTR_ERR(versatile_cfg_base[0]); return PTR_ERR(versatile_cfg_base[0]);
......
...@@ -933,7 +933,6 @@ static int brcm_pcie_probe(struct platform_device *pdev) ...@@ -933,7 +933,6 @@ static int brcm_pcie_probe(struct platform_device *pdev)
struct pci_host_bridge *bridge; struct pci_host_bridge *bridge;
struct device_node *fw_np; struct device_node *fw_np;
struct brcm_pcie *pcie; struct brcm_pcie *pcie;
struct resource *res;
int ret; int ret;
/* /*
...@@ -958,8 +957,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) ...@@ -958,8 +957,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
pcie->dev = &pdev->dev; pcie->dev = &pdev->dev;
pcie->np = np; pcie->np = np;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pcie->base = devm_platform_ioremap_resource(pdev, 0);
pcie->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pcie->base)) if (IS_ERR(pcie->base))
return PTR_ERR(pcie->base); return PTR_ERR(pcie->base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment