use devm_platform_ioremap_resource() to simplify code, it
contains platform_get_resource() and devm_ioremap_resource().
Signed-off-by: Dejin Zheng <[email protected]>
---
drivers/pci/controller/dwc/pci-exynos.c | 4 +---
drivers/pci/controller/pci-aardvark.c | 5 ++---
drivers/pci/controller/pci-ftpci100.c | 4 +---
drivers/pci/controller/pci-versatile.c | 6 ++----
drivers/pci/controller/pcie-brcmstb.c | 4 +---
5 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c
index c5043d951e80..5791039d6a54 100644
--- a/drivers/pci/controller/dwc/pci-exynos.c
+++ b/drivers/pci/controller/dwc/pci-exynos.c
@@ -84,14 +84,12 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev,
{
struct dw_pcie *pci = ep->pci;
struct device *dev = pci->dev;
- struct resource *res;
ep->mem_res = devm_kzalloc(dev, sizeof(*ep->mem_res), GFP_KERNEL);
if (!ep->mem_res)
return -ENOMEM;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- ep->mem_res->elbi_base = devm_ioremap_resource(dev, res);
+ ep->mem_res->elbi_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(ep->mem_res->elbi_base))
return PTR_ERR(ep->mem_res->elbi_base);
diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
index 90ff291c24f0..0d98f9b04daa 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1105,7 +1105,7 @@ static int advk_pcie_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct advk_pcie *pcie;
- struct resource *res, *bus;
+ struct resource *bus;
struct pci_host_bridge *bridge;
int ret, irq;
@@ -1116,8 +1116,7 @@ static int advk_pcie_probe(struct platform_device *pdev)
pcie = pci_host_bridge_priv(bridge);
pcie->pdev = pdev;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- pcie->base = devm_ioremap_resource(dev, res);
+ pcie->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(pcie->base))
return PTR_ERR(pcie->base);
diff --git a/drivers/pci/controller/pci-ftpci100.c b/drivers/pci/controller/pci-ftpci100.c
index 1b67564de7af..221dfc9dc81b 100644
--- a/drivers/pci/controller/pci-ftpci100.c
+++ b/drivers/pci/controller/pci-ftpci100.c
@@ -422,7 +422,6 @@ static int faraday_pci_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
const struct faraday_pci_variant *variant =
of_device_get_match_data(dev);
- struct resource *regs;
struct resource_entry *win;
struct faraday_pci *p;
struct resource *io;
@@ -465,8 +464,7 @@ static int faraday_pci_probe(struct platform_device *pdev)
return ret;
}
- regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- p->base = devm_ioremap_resource(dev, regs);
+ p->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(p->base))
return PTR_ERR(p->base);
diff --git a/drivers/pci/controller/pci-versatile.c b/drivers/pci/controller/pci-versatile.c
index b911359b6d81..b34bbfe611e7 100644
--- a/drivers/pci/controller/pci-versatile.c
+++ b/drivers/pci/controller/pci-versatile.c
@@ -77,13 +77,11 @@ static int versatile_pci_probe(struct platform_device *pdev)
if (!bridge)
return -ENOMEM;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- versatile_pci_base = devm_ioremap_resource(dev, res);
+ versatile_pci_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(versatile_pci_base))
return PTR_ERR(versatile_pci_base);
- res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- versatile_cfg_base[0] = devm_ioremap_resource(dev, res);
+ versatile_cfg_base[0] = devm_platform_ioremap_resource(pdev, 1);
if (IS_ERR(versatile_cfg_base[0]))
return PTR_ERR(versatile_cfg_base[0]);
diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index 7730ea845ff2..04bbf9b40193 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -934,7 +934,6 @@ static int brcm_pcie_probe(struct platform_device *pdev)
struct device_node *fw_np;
struct brcm_pcie *pcie;
struct pci_bus *child;
- struct resource *res;
int ret;
/*
@@ -959,8 +958,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
pcie->dev = &pdev->dev;
pcie->np = np;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- pcie->base = devm_ioremap_resource(&pdev->dev, res);
+ pcie->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(pcie->base))
return PTR_ERR(pcie->base);
--
2.25.0
On Wed, 27 May 2020 00:01:10 +0800, Dejin Zheng wrote:
> use devm_platform_ioremap_resource() to simplify code, it
> contains platform_get_resource() and devm_ioremap_resource().
>
> Signed-off-by: Dejin Zheng <[email protected]>
> ---
> drivers/pci/controller/dwc/pci-exynos.c | 4 +---
> drivers/pci/controller/pci-aardvark.c | 5 ++---
> drivers/pci/controller/pci-ftpci100.c | 4 +---
> drivers/pci/controller/pci-versatile.c | 6 ++----
> drivers/pci/controller/pcie-brcmstb.c | 4 +---
> 5 files changed, 7 insertions(+), 16 deletions(-)
>
Reviewed-by: Rob Herring <[email protected]>
On Wed, May 27, 2020 at 12:01:10AM +0800, Dejin Zheng wrote:
> use devm_platform_ioremap_resource() to simplify code, it
> contains platform_get_resource() and devm_ioremap_resource().
>
> Signed-off-by: Dejin Zheng <[email protected]>
> ---
> drivers/pci/controller/dwc/pci-exynos.c | 4 +---
> drivers/pci/controller/pci-aardvark.c | 5 ++---
> drivers/pci/controller/pci-ftpci100.c | 4 +---
> drivers/pci/controller/pci-versatile.c | 6 ++----
> drivers/pci/controller/pcie-brcmstb.c | 4 +---
> 5 files changed, 7 insertions(+), 16 deletions(-)
Can you rebase it please against:
git://git.kernel.org/pub/scm/linux/kernel/git/lpieralisi/pci.git pci/misc
I will apply it then (please carry over the review tags).
Lorenzo
> diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c
> index c5043d951e80..5791039d6a54 100644
> --- a/drivers/pci/controller/dwc/pci-exynos.c
> +++ b/drivers/pci/controller/dwc/pci-exynos.c
> @@ -84,14 +84,12 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev,
> {
> struct dw_pcie *pci = ep->pci;
> struct device *dev = pci->dev;
> - struct resource *res;
>
> ep->mem_res = devm_kzalloc(dev, sizeof(*ep->mem_res), GFP_KERNEL);
> if (!ep->mem_res)
> return -ENOMEM;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - ep->mem_res->elbi_base = devm_ioremap_resource(dev, res);
> + ep->mem_res->elbi_base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(ep->mem_res->elbi_base))
> return PTR_ERR(ep->mem_res->elbi_base);
>
> diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
> index 90ff291c24f0..0d98f9b04daa 100644
> --- a/drivers/pci/controller/pci-aardvark.c
> +++ b/drivers/pci/controller/pci-aardvark.c
> @@ -1105,7 +1105,7 @@ static int advk_pcie_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct advk_pcie *pcie;
> - struct resource *res, *bus;
> + struct resource *bus;
> struct pci_host_bridge *bridge;
> int ret, irq;
>
> @@ -1116,8 +1116,7 @@ static int advk_pcie_probe(struct platform_device *pdev)
> pcie = pci_host_bridge_priv(bridge);
> pcie->pdev = pdev;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - pcie->base = devm_ioremap_resource(dev, res);
> + pcie->base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(pcie->base))
> return PTR_ERR(pcie->base);
>
> diff --git a/drivers/pci/controller/pci-ftpci100.c b/drivers/pci/controller/pci-ftpci100.c
> index 1b67564de7af..221dfc9dc81b 100644
> --- a/drivers/pci/controller/pci-ftpci100.c
> +++ b/drivers/pci/controller/pci-ftpci100.c
> @@ -422,7 +422,6 @@ static int faraday_pci_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> const struct faraday_pci_variant *variant =
> of_device_get_match_data(dev);
> - struct resource *regs;
> struct resource_entry *win;
> struct faraday_pci *p;
> struct resource *io;
> @@ -465,8 +464,7 @@ static int faraday_pci_probe(struct platform_device *pdev)
> return ret;
> }
>
> - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - p->base = devm_ioremap_resource(dev, regs);
> + p->base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(p->base))
> return PTR_ERR(p->base);
>
> diff --git a/drivers/pci/controller/pci-versatile.c b/drivers/pci/controller/pci-versatile.c
> index b911359b6d81..b34bbfe611e7 100644
> --- a/drivers/pci/controller/pci-versatile.c
> +++ b/drivers/pci/controller/pci-versatile.c
> @@ -77,13 +77,11 @@ static int versatile_pci_probe(struct platform_device *pdev)
> if (!bridge)
> return -ENOMEM;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - versatile_pci_base = devm_ioremap_resource(dev, res);
> + versatile_pci_base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(versatile_pci_base))
> return PTR_ERR(versatile_pci_base);
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> - versatile_cfg_base[0] = devm_ioremap_resource(dev, res);
> + versatile_cfg_base[0] = devm_platform_ioremap_resource(pdev, 1);
> if (IS_ERR(versatile_cfg_base[0]))
> return PTR_ERR(versatile_cfg_base[0]);
>
> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> index 7730ea845ff2..04bbf9b40193 100644
> --- a/drivers/pci/controller/pcie-brcmstb.c
> +++ b/drivers/pci/controller/pcie-brcmstb.c
> @@ -934,7 +934,6 @@ static int brcm_pcie_probe(struct platform_device *pdev)
> struct device_node *fw_np;
> struct brcm_pcie *pcie;
> struct pci_bus *child;
> - struct resource *res;
> int ret;
>
> /*
> @@ -959,8 +958,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
> pcie->dev = &pdev->dev;
> pcie->np = np;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - pcie->base = devm_ioremap_resource(&pdev->dev, res);
> + pcie->base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(pcie->base))
> return PTR_ERR(pcie->base);
>
> --
> 2.25.0
>
use devm_platform_ioremap_resource() to simplify code, it
contains platform_get_resource() and devm_ioremap_resource().
Signed-off-by: Dejin Zheng <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---
v1 -> v2:
- rebase to pci/misc branch
- add Rob Reviewed tag and Thanks for Bob's help.
drivers/pci/controller/dwc/pci-exynos.c | 4 +---
drivers/pci/controller/pci-aardvark.c | 5 ++---
drivers/pci/controller/pci-ftpci100.c | 4 +---
drivers/pci/controller/pci-versatile.c | 6 ++----
drivers/pci/controller/pcie-brcmstb.c | 4 +---
5 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c
index c5043d951e80..5791039d6a54 100644
--- a/drivers/pci/controller/dwc/pci-exynos.c
+++ b/drivers/pci/controller/dwc/pci-exynos.c
@@ -84,14 +84,12 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev,
{
struct dw_pcie *pci = ep->pci;
struct device *dev = pci->dev;
- struct resource *res;
ep->mem_res = devm_kzalloc(dev, sizeof(*ep->mem_res), GFP_KERNEL);
if (!ep->mem_res)
return -ENOMEM;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- ep->mem_res->elbi_base = devm_ioremap_resource(dev, res);
+ ep->mem_res->elbi_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(ep->mem_res->elbi_base))
return PTR_ERR(ep->mem_res->elbi_base);
diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
index 90ff291c24f0..0d98f9b04daa 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1105,7 +1105,7 @@ static int advk_pcie_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct advk_pcie *pcie;
- struct resource *res, *bus;
+ struct resource *bus;
struct pci_host_bridge *bridge;
int ret, irq;
@@ -1116,8 +1116,7 @@ static int advk_pcie_probe(struct platform_device *pdev)
pcie = pci_host_bridge_priv(bridge);
pcie->pdev = pdev;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- pcie->base = devm_ioremap_resource(dev, res);
+ pcie->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(pcie->base))
return PTR_ERR(pcie->base);
diff --git a/drivers/pci/controller/pci-ftpci100.c b/drivers/pci/controller/pci-ftpci100.c
index 1b67564de7af..221dfc9dc81b 100644
--- a/drivers/pci/controller/pci-ftpci100.c
+++ b/drivers/pci/controller/pci-ftpci100.c
@@ -422,7 +422,6 @@ static int faraday_pci_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
const struct faraday_pci_variant *variant =
of_device_get_match_data(dev);
- struct resource *regs;
struct resource_entry *win;
struct faraday_pci *p;
struct resource *io;
@@ -465,8 +464,7 @@ static int faraday_pci_probe(struct platform_device *pdev)
return ret;
}
- regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- p->base = devm_ioremap_resource(dev, regs);
+ p->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(p->base))
return PTR_ERR(p->base);
diff --git a/drivers/pci/controller/pci-versatile.c b/drivers/pci/controller/pci-versatile.c
index e90f0cc65c73..a8d361f6c5d9 100644
--- a/drivers/pci/controller/pci-versatile.c
+++ b/drivers/pci/controller/pci-versatile.c
@@ -76,13 +76,11 @@ static int versatile_pci_probe(struct platform_device *pdev)
if (!bridge)
return -ENOMEM;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- versatile_pci_base = devm_ioremap_resource(dev, res);
+ versatile_pci_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(versatile_pci_base))
return PTR_ERR(versatile_pci_base);
- res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- versatile_cfg_base[0] = devm_ioremap_resource(dev, res);
+ versatile_cfg_base[0] = devm_platform_ioremap_resource(pdev, 1);
if (IS_ERR(versatile_cfg_base[0]))
return PTR_ERR(versatile_cfg_base[0]);
diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index 15c747c1390a..91a4b7f3ee45 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -933,7 +933,6 @@ static int brcm_pcie_probe(struct platform_device *pdev)
struct pci_host_bridge *bridge;
struct device_node *fw_np;
struct brcm_pcie *pcie;
- struct resource *res;
int ret;
/*
@@ -958,8 +957,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
pcie->dev = &pdev->dev;
pcie->np = np;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- pcie->base = devm_ioremap_resource(&pdev->dev, res);
+ pcie->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(pcie->base))
return PTR_ERR(pcie->base);
--
2.25.0
On Tue, Jul 07, 2020 at 02:37:07PM +0100, Lorenzo Pieralisi wrote:
> On Wed, May 27, 2020 at 12:01:10AM +0800, Dejin Zheng wrote:
> > use devm_platform_ioremap_resource() to simplify code, it
> > contains platform_get_resource() and devm_ioremap_resource().
> >
> > Signed-off-by: Dejin Zheng <[email protected]>
> > ---
> > drivers/pci/controller/dwc/pci-exynos.c | 4 +---
> > drivers/pci/controller/pci-aardvark.c | 5 ++---
> > drivers/pci/controller/pci-ftpci100.c | 4 +---
> > drivers/pci/controller/pci-versatile.c | 6 ++----
> > drivers/pci/controller/pcie-brcmstb.c | 4 +---
> > 5 files changed, 7 insertions(+), 16 deletions(-)
>
> Can you rebase it please against:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/lpieralisi/pci.git pci/misc
>
> I will apply it then (please carry over the review tags).
>
Hi Lorenzo:
I have sent the patch v2 for rebase it, Thank you very much!
The link is here: https://patchwork.ozlabs.org/project/linux-pci/patch/[email protected]/
BR,
Dejin
> Lorenzo
>
> > diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c
> > index c5043d951e80..5791039d6a54 100644
> > --- a/drivers/pci/controller/dwc/pci-exynos.c
> > +++ b/drivers/pci/controller/dwc/pci-exynos.c
> > @@ -84,14 +84,12 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev,
> > {
> > struct dw_pcie *pci = ep->pci;
> > struct device *dev = pci->dev;
> > - struct resource *res;
> >
> > ep->mem_res = devm_kzalloc(dev, sizeof(*ep->mem_res), GFP_KERNEL);
> > if (!ep->mem_res)
> > return -ENOMEM;
> >
> > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > - ep->mem_res->elbi_base = devm_ioremap_resource(dev, res);
> > + ep->mem_res->elbi_base = devm_platform_ioremap_resource(pdev, 0);
> > if (IS_ERR(ep->mem_res->elbi_base))
> > return PTR_ERR(ep->mem_res->elbi_base);
> >
> > diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
> > index 90ff291c24f0..0d98f9b04daa 100644
> > --- a/drivers/pci/controller/pci-aardvark.c
> > +++ b/drivers/pci/controller/pci-aardvark.c
> > @@ -1105,7 +1105,7 @@ static int advk_pcie_probe(struct platform_device *pdev)
> > {
> > struct device *dev = &pdev->dev;
> > struct advk_pcie *pcie;
> > - struct resource *res, *bus;
> > + struct resource *bus;
> > struct pci_host_bridge *bridge;
> > int ret, irq;
> >
> > @@ -1116,8 +1116,7 @@ static int advk_pcie_probe(struct platform_device *pdev)
> > pcie = pci_host_bridge_priv(bridge);
> > pcie->pdev = pdev;
> >
> > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > - pcie->base = devm_ioremap_resource(dev, res);
> > + pcie->base = devm_platform_ioremap_resource(pdev, 0);
> > if (IS_ERR(pcie->base))
> > return PTR_ERR(pcie->base);
> >
> > diff --git a/drivers/pci/controller/pci-ftpci100.c b/drivers/pci/controller/pci-ftpci100.c
> > index 1b67564de7af..221dfc9dc81b 100644
> > --- a/drivers/pci/controller/pci-ftpci100.c
> > +++ b/drivers/pci/controller/pci-ftpci100.c
> > @@ -422,7 +422,6 @@ static int faraday_pci_probe(struct platform_device *pdev)
> > struct device *dev = &pdev->dev;
> > const struct faraday_pci_variant *variant =
> > of_device_get_match_data(dev);
> > - struct resource *regs;
> > struct resource_entry *win;
> > struct faraday_pci *p;
> > struct resource *io;
> > @@ -465,8 +464,7 @@ static int faraday_pci_probe(struct platform_device *pdev)
> > return ret;
> > }
> >
> > - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > - p->base = devm_ioremap_resource(dev, regs);
> > + p->base = devm_platform_ioremap_resource(pdev, 0);
> > if (IS_ERR(p->base))
> > return PTR_ERR(p->base);
> >
> > diff --git a/drivers/pci/controller/pci-versatile.c b/drivers/pci/controller/pci-versatile.c
> > index b911359b6d81..b34bbfe611e7 100644
> > --- a/drivers/pci/controller/pci-versatile.c
> > +++ b/drivers/pci/controller/pci-versatile.c
> > @@ -77,13 +77,11 @@ static int versatile_pci_probe(struct platform_device *pdev)
> > if (!bridge)
> > return -ENOMEM;
> >
> > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > - versatile_pci_base = devm_ioremap_resource(dev, res);
> > + versatile_pci_base = devm_platform_ioremap_resource(pdev, 0);
> > if (IS_ERR(versatile_pci_base))
> > return PTR_ERR(versatile_pci_base);
> >
> > - res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> > - versatile_cfg_base[0] = devm_ioremap_resource(dev, res);
> > + versatile_cfg_base[0] = devm_platform_ioremap_resource(pdev, 1);
> > if (IS_ERR(versatile_cfg_base[0]))
> > return PTR_ERR(versatile_cfg_base[0]);
> >
> > diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> > index 7730ea845ff2..04bbf9b40193 100644
> > --- a/drivers/pci/controller/pcie-brcmstb.c
> > +++ b/drivers/pci/controller/pcie-brcmstb.c
> > @@ -934,7 +934,6 @@ static int brcm_pcie_probe(struct platform_device *pdev)
> > struct device_node *fw_np;
> > struct brcm_pcie *pcie;
> > struct pci_bus *child;
> > - struct resource *res;
> > int ret;
> >
> > /*
> > @@ -959,8 +958,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
> > pcie->dev = &pdev->dev;
> > pcie->np = np;
> >
> > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > - pcie->base = devm_ioremap_resource(&pdev->dev, res);
> > + pcie->base = devm_platform_ioremap_resource(pdev, 0);
> > if (IS_ERR(pcie->base))
> > return PTR_ERR(pcie->base);
> >
> > --
> > 2.25.0
> >
On Wed, Jul 08, 2020 at 11:56:14PM +0800, Dejin Zheng wrote:
> use devm_platform_ioremap_resource() to simplify code, it
> contains platform_get_resource() and devm_ioremap_resource().
>
> Signed-off-by: Dejin Zheng <[email protected]>
> Reviewed-by: Rob Herring <[email protected]>
> ---
> v1 -> v2:
> - rebase to pci/misc branch
> - add Rob Reviewed tag and Thanks for Bob's help.
>
> drivers/pci/controller/dwc/pci-exynos.c | 4 +---
> drivers/pci/controller/pci-aardvark.c | 5 ++---
> drivers/pci/controller/pci-ftpci100.c | 4 +---
> drivers/pci/controller/pci-versatile.c | 6 ++----
> drivers/pci/controller/pcie-brcmstb.c | 4 +---
> 5 files changed, 7 insertions(+), 16 deletions(-)
Applied to pci/misc, thanks.
Lorenzo
> diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c
> index c5043d951e80..5791039d6a54 100644
> --- a/drivers/pci/controller/dwc/pci-exynos.c
> +++ b/drivers/pci/controller/dwc/pci-exynos.c
> @@ -84,14 +84,12 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev,
> {
> struct dw_pcie *pci = ep->pci;
> struct device *dev = pci->dev;
> - struct resource *res;
>
> ep->mem_res = devm_kzalloc(dev, sizeof(*ep->mem_res), GFP_KERNEL);
> if (!ep->mem_res)
> return -ENOMEM;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - ep->mem_res->elbi_base = devm_ioremap_resource(dev, res);
> + ep->mem_res->elbi_base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(ep->mem_res->elbi_base))
> return PTR_ERR(ep->mem_res->elbi_base);
>
> diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
> index 90ff291c24f0..0d98f9b04daa 100644
> --- a/drivers/pci/controller/pci-aardvark.c
> +++ b/drivers/pci/controller/pci-aardvark.c
> @@ -1105,7 +1105,7 @@ static int advk_pcie_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct advk_pcie *pcie;
> - struct resource *res, *bus;
> + struct resource *bus;
> struct pci_host_bridge *bridge;
> int ret, irq;
>
> @@ -1116,8 +1116,7 @@ static int advk_pcie_probe(struct platform_device *pdev)
> pcie = pci_host_bridge_priv(bridge);
> pcie->pdev = pdev;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - pcie->base = devm_ioremap_resource(dev, res);
> + pcie->base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(pcie->base))
> return PTR_ERR(pcie->base);
>
> diff --git a/drivers/pci/controller/pci-ftpci100.c b/drivers/pci/controller/pci-ftpci100.c
> index 1b67564de7af..221dfc9dc81b 100644
> --- a/drivers/pci/controller/pci-ftpci100.c
> +++ b/drivers/pci/controller/pci-ftpci100.c
> @@ -422,7 +422,6 @@ static int faraday_pci_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> const struct faraday_pci_variant *variant =
> of_device_get_match_data(dev);
> - struct resource *regs;
> struct resource_entry *win;
> struct faraday_pci *p;
> struct resource *io;
> @@ -465,8 +464,7 @@ static int faraday_pci_probe(struct platform_device *pdev)
> return ret;
> }
>
> - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - p->base = devm_ioremap_resource(dev, regs);
> + p->base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(p->base))
> return PTR_ERR(p->base);
>
> diff --git a/drivers/pci/controller/pci-versatile.c b/drivers/pci/controller/pci-versatile.c
> index e90f0cc65c73..a8d361f6c5d9 100644
> --- a/drivers/pci/controller/pci-versatile.c
> +++ b/drivers/pci/controller/pci-versatile.c
> @@ -76,13 +76,11 @@ static int versatile_pci_probe(struct platform_device *pdev)
> if (!bridge)
> return -ENOMEM;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - versatile_pci_base = devm_ioremap_resource(dev, res);
> + versatile_pci_base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(versatile_pci_base))
> return PTR_ERR(versatile_pci_base);
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> - versatile_cfg_base[0] = devm_ioremap_resource(dev, res);
> + versatile_cfg_base[0] = devm_platform_ioremap_resource(pdev, 1);
> if (IS_ERR(versatile_cfg_base[0]))
> return PTR_ERR(versatile_cfg_base[0]);
>
> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> index 15c747c1390a..91a4b7f3ee45 100644
> --- a/drivers/pci/controller/pcie-brcmstb.c
> +++ b/drivers/pci/controller/pcie-brcmstb.c
> @@ -933,7 +933,6 @@ static int brcm_pcie_probe(struct platform_device *pdev)
> struct pci_host_bridge *bridge;
> struct device_node *fw_np;
> struct brcm_pcie *pcie;
> - struct resource *res;
> int ret;
>
> /*
> @@ -958,8 +957,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
> pcie->dev = &pdev->dev;
> pcie->np = np;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - pcie->base = devm_ioremap_resource(&pdev->dev, res);
> + pcie->base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(pcie->base))
> return PTR_ERR(pcie->base);
>
> --
> 2.25.0
>