Skip to contentSkip to conversation

mmc: sunxi-mmc: convert to devm_platform_ioremap_resource

PATCH In review Yangtao Li 5 participants 19 messages Dec 15, 2019 – Dec 18, 2019

Subsystems (14)
lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/13 mmc: sunxi-mmc: convert to devm_platform_ioremap_resource

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mmc/host/sunxi-mmc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/host/sunxi-mmc.c +1 -2
index d577a6b0ceae..f87d7967457f 100644
@@ -1273,8 +1273,7 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
 	if (ret)
 		return ret;
 
-	host->reg_base = devm_ioremap_resource(&pdev->dev,
-			      platform_get_resource(pdev, IORESOURCE_MEM, 0));
+	host->reg_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(host->reg_base))
 		return PTR_ERR(host->reg_base);
 
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 2/13 mmc: tmio: convert to devm_platform_ioremap_resource

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mmc/host/tmio_mmc_core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/tmio_mmc_core.c +1 -3
index c4a1d49fbea4..365d518c6d7d 100644
@@ -1109,12 +1109,10 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,
 {
 	struct tmio_mmc_host *host;
 	struct mmc_host *mmc;
-	struct resource *res;
 	void __iomem *ctl;
 	int ret;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ctl = devm_ioremap_resource(&pdev->dev, res);
+	ctl = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(ctl))
 		return ERR_CAST(ctl);
 
Signature · 1 line
2.17.1
Reviewed-by Tested-by on v1 2/13
#2 lore raw

Re: [PATCH 02/13] mmc: tmio: convert to devm_platform_ioremap_resource

Quoted 3 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

I am not a big fan of this new function, but oh well...

Tested on a Lager board (R-Car H2), SDHI gets recognized and SD cards are detected.

author
#3 lore raw

PATCH 3/13 mmc: meson-mx-sdio: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mmc/host/meson-mx-sdio.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/meson-mx-sdio.c +1 -3
index ba9a63db73da..8b038e7b2cd3 100644
@@ -638,7 +638,6 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
 	struct platform_device *slot_pdev;
 	struct mmc_host *mmc;
 	struct meson_mx_mmc_host *host;
-	struct resource *res;
 	int ret, irq;
 	u32 conf;
 
@@ -663,8 +662,7 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, host);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	host->base = devm_ioremap_resource(host->controller_dev, res);
+	host->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(host->base)) {
 		ret = PTR_ERR(host->base);
 		goto error_free_mmc;
Signature · 1 line
2.17.1
author
#4 lore raw

PATCH 4/13 mmc: sdhci-s3c: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mmc/host/sdhci-s3c.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/sdhci-s3c.c +1 -3
index 51e096f27388..e72352beb13a 100644
@@ -481,7 +481,6 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct sdhci_host *host;
 	struct sdhci_s3c *sc;
-	struct resource *res;
 	int ret, irq, ptr, clks;
 
 	if (!pdev->dev.platform_data && !pdev->dev.of_node) {
@@ -555,8 +554,7 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
 		goto err_no_busclks;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	host->ioaddr = devm_ioremap_resource(&pdev->dev, res);
+	host->ioaddr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(host->ioaddr)) {
 		ret = PTR_ERR(host->ioaddr);
 		goto err_req_regs;
Signature · 1 line
2.17.1
author
#5 lore raw

PATCH 5/13 mmc: sdhci-spear: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mmc/host/sdhci-spear.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/sdhci-spear.c +1 -3
index 916b5b09c3d1..37f1c41c8a9c 100644
@@ -43,7 +43,6 @@ static const struct sdhci_ops sdhci_pltfm_ops = {
 static int sdhci_probe(struct platform_device *pdev)
 {
 	struct sdhci_host *host;
-	struct resource *iomem;
 	struct spear_sdhci *sdhci;
 	struct device *dev;
 	int ret;
@@ -56,8 +55,7 @@ static int sdhci_probe(struct platform_device *pdev)
 		goto err;
 	}
 
-	iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	host->ioaddr = devm_ioremap_resource(&pdev->dev, iomem);
+	host->ioaddr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(host->ioaddr)) {
 		ret = PTR_ERR(host->ioaddr);
 		dev_dbg(&pdev->dev, "unable to map iomem: %d\n", ret);
Signature · 1 line
2.17.1
author
#6 lore raw

PATCH 6/13 mmc: sh_mmcif: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mmc/host/sh_mmcif.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/sh_mmcif.c +1 -3
index 98c575de43c7..5069f1cbcef8 100644
@@ -1388,7 +1388,6 @@ static int sh_mmcif_probe(struct platform_device *pdev)
 	struct sh_mmcif_host *host;
 	struct device *dev = &pdev->dev;
 	struct sh_mmcif_plat_data *pd = dev->platform_data;
-	struct resource *res;
 	void __iomem *reg;
 	const char *name;
 
@@ -1397,8 +1396,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
 	if (irq[0] < 0)
 		return -ENXIO;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	reg = devm_ioremap_resource(dev, res);
+	reg = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(reg))
 		return PTR_ERR(reg);
 
Signature · 1 line
2.17.1
author
#8 lore raw

PATCH 7/13 mmc: sdhci_f_sdh30: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mmc/host/sdhci_f_sdh30.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/sdhci_f_sdh30.c +1 -3
index fa0dfc657c22..4625cc071b61 100644
@@ -89,7 +89,6 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev)
 {
 	struct sdhci_host *host;
 	struct device *dev = &pdev->dev;
-	struct resource *res;
 	int irq, ctrl = 0, ret = 0;
 	struct f_sdhost_priv *priv;
 	u32 reg = 0;
@@ -123,8 +122,7 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev)
 	host->ops = &sdhci_f_sdh30_ops;
 	host->irq = irq;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	host->ioaddr = devm_ioremap_resource(&pdev->dev, res);
+	host->ioaddr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(host->ioaddr)) {
 		ret = PTR_ERR(host->ioaddr);
 		goto err;
Signature · 1 line
2.17.1
author
#9 lore raw

PATCH 8/13 mmc: sdhci_am654: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mmc/host/sdhci_am654.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/sdhci_am654.c +1 -3
index b8e897e31e2e..aa237f565e23 100644
@@ -491,7 +491,6 @@ static int sdhci_am654_probe(struct platform_device *pdev)
 	struct sdhci_am654_data *sdhci_am654;
 	const struct of_device_id *match;
 	struct sdhci_host *host;
-	struct resource *res;
 	struct clk *clk_xin;
 	struct device *dev = &pdev->dev;
 	void __iomem *base;
@@ -524,8 +523,7 @@ static int sdhci_am654_probe(struct platform_device *pdev)
 		goto pm_runtime_disable;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	base = devm_ioremap_resource(dev, res);
+	base = devm_platform_ioremap_resource(pdev, 1);
 	if (IS_ERR(base)) {
 		ret = PTR_ERR(base);
 		goto pm_runtime_put;
Signature · 1 line
2.17.1
author
#10 lore raw

PATCH 9/13 mmc: sdhci-milbeaut: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mmc/host/sdhci-milbeaut.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/sdhci-milbeaut.c +1 -3
index a1aa21b9ae1c..e6245b7bda21 100644
@@ -242,7 +242,6 @@ static int sdhci_milbeaut_probe(struct platform_device *pdev)
 {
 	struct sdhci_host *host;
 	struct device *dev = &pdev->dev;
-	struct resource *res;
 	int irq, ret = 0;
 	struct f_sdhost_priv *priv;
 
@@ -280,8 +279,7 @@ static int sdhci_milbeaut_probe(struct platform_device *pdev)
 	host->ops = &sdhci_milbeaut_ops;
 	host->irq = irq;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	host->ioaddr = devm_ioremap_resource(&pdev->dev, res);
+	host->ioaddr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(host->ioaddr)) {
 		ret = PTR_ERR(host->ioaddr);
 		goto err;
Signature · 1 line
2.17.1
author
#11 lore raw

PATCH 10/13 mmc: sdhci-msm: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mmc/host/sdhci-msm.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mmc/host/sdhci-msm.c +1 -4
index 3d0bb5e2e09b..6daacef4ceec 100644
@@ -1746,7 +1746,6 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 	struct sdhci_host *host;
 	struct sdhci_pltfm_host *pltfm_host;
 	struct sdhci_msm_host *msm_host;
-	struct resource *core_memres;
 	struct clk *clk;
 	int ret;
 	u16 host_version, core_minor;
@@ -1847,9 +1846,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 	}
 
 	if (!msm_host->mci_removed) {
-		core_memres = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-		msm_host->core_mem = devm_ioremap_resource(&pdev->dev,
-				core_memres);
+		msm_host->core_mem = devm_platform_ioremap_resource(pdev, 1);
 
 		if (IS_ERR(msm_host->core_mem)) {
 			ret = PTR_ERR(msm_host->core_mem);
Signature · 1 line
2.17.1
Reviewed-by on v1 10/13
#12 lore raw

Re: [PATCH 10/13] mmc: sdhci-msm: convert to devm_platform_ioremap_resource

Quoted 20 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mmc/host/sdhci-msm.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mmc/host/sdhci-msm.c +0 -1
index 3d0bb5e2e09b..6daacef4ceec 100644
@@ -1746,7 +1746,6 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 	struct sdhci_host *host;
 	struct sdhci_pltfm_host *pltfm_host;
 	struct sdhci_msm_host *msm_host;
-	struct resource *core_memres;
 	struct clk *clk;
 	int ret;
 	u16 host_version, core_minor;

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 1850

Quoted 8 lines
drivers/mmc/host/sdhci-msm.c +1 -3
@@ -1847,9 +1846,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 	}
 
 	if (!msm_host->mci_removed) {
-		core_memres = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-		msm_host->core_mem = devm_ioremap_resource(&pdev->dev,
-				core_memres);
+		msm_host->core_mem = devm_platform_ioremap_resource(pdev, 1);
 

This would now look better without this empty line.

Regards,
Bjorn

Quoted 5 lines
drivers/mmc/host/sdhci-msm.c +0 -0
 		if (IS_ERR(msm_host->core_mem)) {
 			ret = PTR_ERR(msm_host->core_mem);
Signature · 1 line
2.17.1
#13 lore raw

Re: [PATCH 10/13] mmc: sdhci-msm: convert to devm_platform_ioremap_resource

-trimmed cc list

Quoted 25 lines · Bjorn Andersson
Quoted 22 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mmc/host/sdhci-msm.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mmc/host/sdhci-msm.c +0 -1
index 3d0bb5e2e09b..6daacef4ceec 100644
@@ -1746,7 +1746,6 @@ static int sdhci_msm_probe(struct platform_device *pdev)
      struct sdhci_host *host;
      struct sdhci_pltfm_host *pltfm_host;
      struct sdhci_msm_host *msm_host;
-     struct resource *core_memres;
      struct clk *clk;
      int ret;
      u16 host_version, core_minor;
@@ -1847,9 +1846,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
      }
 
Quoted 8 lines

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_probe(struct platform_device *pdev) · line 1850

Quoted 6 lines
drivers/mmc/host/sdhci-msm.c +1 -3
      if (!msm_host->mci_removed) {
-             core_memres = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-             msm_host->core_mem = devm_ioremap_resource(&pdev->dev,
-                             core_memres);
+             msm_host->core_mem = devm_platform_ioremap_resource(pdev, 1);
 

This would now look better without this empty line.

Good point, I fixed it when applying. No actions needed.

Quoted 3 lines

[...]

Kind regards
Uffe

author
#14 lore raw

PATCH 11/13 mmc: mvsdio: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mmc/host/mvsdio.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mmc/host/mvsdio.c +2 -4
index 74a0a7fbbf7f..203b61712601 100644
@@ -696,16 +696,14 @@ static int mvsd_probe(struct platform_device *pdev)
 	struct mmc_host *mmc = NULL;
 	struct mvsd_host *host = NULL;
 	const struct mbus_dram_target_info *dram;
-	struct resource *r;
 	int ret, irq;
 
 	if (!np) {
 		dev_err(&pdev->dev, "no DT node\n");
 		return -ENODEV;
 	}
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(pdev, 0);
-	if (!r || irq < 0)
+	if (irq < 0)
 		return -ENXIO;
 
 	mmc = mmc_alloc_host(sizeof(struct mvsd_host), &pdev->dev);
@@ -758,7 +756,7 @@ static int mvsd_probe(struct platform_device *pdev)
 
 	spin_lock_init(&host->lock);
 
-	host->base = devm_ioremap_resource(&pdev->dev, r);
+	host->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(host->base)) {
 		ret = PTR_ERR(host->base);
 		goto out;
Signature · 1 line
2.17.1
author
#15 lore raw

PATCH 12/13 mmc: mtk-sd: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mmc/host/mtk-sd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/host/mtk-sd.c +1 -2
index 010fe29a4888..7726dcf48f2c 100644
@@ -2194,8 +2194,7 @@ static int msdc_drv_probe(struct platform_device *pdev)
 	if (ret)
 		goto host_free;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	host->base = devm_ioremap_resource(&pdev->dev, res);
+	host->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(host->base)) {
 		ret = PTR_ERR(host->base);
 		goto host_free;
Signature · 1 line
2.17.1
author
#16 lore raw

PATCH 13/13 mmc: au1xmmc: switch to platform_get_irq

In reply to Yangtao Li

platform_get_resource(pdev, IORESOURCE_IRQ) is not recommended for requesting IRQ's resources, as they can be not ready yet. Using platform_get_irq() instead is preferred for getting IRQ even if it was not retrieved earlier.

---
 drivers/mmc/host/au1xmmc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/mmc/host/au1xmmc.c +2 -5
index bc8aeb47a7b4..8823680ca42c 100644
@@ -984,12 +984,9 @@ static int au1xmmc_probe(struct platform_device *pdev)
 		goto out2;
 	}
 
-	r = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!r) {
-		dev_err(&pdev->dev, "no IRQ defined\n");
+	host->irq = platform_get_irq(pdev, 0);
+	if (host->irq < 0)
 		goto out3;
-	}
-	host->irq = r->start;
 
 	mmc->ops = &au1xmmc_ops;
 
Signature · 1 line
2.17.1
#17 lore raw

Re: [PATCH 13/13] mmc: au1xmmc: switch to platform_get_irq

- trimmed cc list (please do that also for any future submissions).

Quoted 7 lines · Yangtao Li

platform_get_resource(pdev, IORESOURCE_IRQ) is not recommended for requesting IRQ's resources, as they can be not ready yet. Using platform_get_irq() instead is preferred for getting IRQ even if it was not retrieved earlier.

Patch 1->13 applied for next, thanks!

Next time, please use a cover-letter when you send a series.

Kind regards
Uffe

Quoted 26 lines
---
 drivers/mmc/host/au1xmmc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/mmc/host/au1xmmc.c +2 -6
index bc8aeb47a7b4..8823680ca42c 100644
@@ -984,12 +984,9 @@ static int au1xmmc_probe(struct platform_device *pdev)
                goto out2;
        }
 
-       r = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-       if (!r) {
-               dev_err(&pdev->dev, "no IRQ defined\n");
+       host->irq = platform_get_irq(pdev, 0);
+       if (host->irq < 0)
                goto out3;
-       }
-       host->irq = r->start;
 
        mmc->ops = &au1xmmc_ops;
 
--

2.17.1

maintainer Acked-by on v1 1/13
#18 lore raw
In reply to Yangtao Li
Quoted 5 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---

Quoted 20 lines
 drivers/mmc/host/sunxi-mmc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/host/sunxi-mmc.c +1 -3
index d577a6b0ceae..f87d7967457f 100644
@@ -1273,8 +1273,7 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
        if (ret)
                return ret;
 
-       host->reg_base = devm_ioremap_resource(&pdev->dev,
-                             platform_get_resource(pdev, IORESOURCE_MEM, 0));
+       host->reg_base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(host->reg_base))
                return PTR_ERR(host->reg_base);
 
--

2.17.1