Skip to contentSkip to conversation

mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource()

PATCH Applied Yangtao Li 4 participants 43 messages Jul 7, 2023 – Jul 15, 2023

Subsystems (9)
lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/18 mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource()

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/mtd/nand/raw/sunxi_nand.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/raw/sunxi_nand.c +1 -2
index 9884304634f6..db36bd755b8d 100644
@@ -2087,8 +2087,7 @@ static int sunxi_nfc_probe(struct platform_device *pdev)
 	nand_controller_init(&nfc->controller);
 	INIT_LIST_HEAD(&nfc->chips);
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	nfc->regs = devm_ioremap_resource(dev, r);
+	nfc->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &r);
 	if (IS_ERR(nfc->regs))
 		return PTR_ERR(nfc->regs);
 
Signature · 1 line
2.39.0
author
#1 lore raw

PATCH 2/18 mtd: rawnand: lpc32xx_slc: Use devm_platform_get_and_ioremap_resource()

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/mtd/nand/raw/lpc32xx_slc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/raw/lpc32xx_slc.c +1 -2
index 3139b6107660..2201264d3c37 100644
@@ -836,8 +836,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
 	if (!host)
 		return -ENOMEM;
 
-	rc = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	host->io_base = devm_ioremap_resource(&pdev->dev, rc);
+	host->io_base = devm_platform_get_and_ioremap_resource(pdev, 0, &rc);
 	if (IS_ERR(host->io_base))
 		return PTR_ERR(host->io_base);
 
Signature · 1 line
2.39.0
maintainer Applied
#2 lore raw

Re: [PATCH 02/18] mtd: rawnand: lpc32xx_slc: Use devm_platform_get_and_ioremap_resource()

Quoted 5 lines · Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author
#3 lore raw

PATCH 3/18 mtd: rawnand: mxc: Convert to devm_platform_ioremap_resource()

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mtd/nand/raw/mxc_nand.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/mtd/nand/raw/mxc_nand.c +3 -6
index 3d4b2e8294ea..2f8dcda0f435 100644
@@ -1696,7 +1696,6 @@ static int mxcnd_probe(struct platform_device *pdev)
 	struct nand_chip *this;
 	struct mtd_info *mtd;
 	struct mxc_nand_host *host;
-	struct resource *res;
 	int err = 0;
 
 	/* Allocate memory for MTD device structure and private data */
@@ -1740,17 +1739,15 @@ static int mxcnd_probe(struct platform_device *pdev)
 		this->options |= NAND_KEEP_TIMINGS;
 
 	if (host->devtype_data->needs_ip) {
-		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-		host->regs_ip = devm_ioremap_resource(&pdev->dev, res);
+		host->regs_ip = devm_platform_ioremap_resource(pdev, 0);
 		if (IS_ERR(host->regs_ip))
 			return PTR_ERR(host->regs_ip);
 
-		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+		host->base = devm_platform_ioremap_resource(pdev, 1);
 	} else {
-		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+		host->base = devm_platform_ioremap_resource(pdev, 0);
 	}
 
-	host->base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(host->base))
 		return PTR_ERR(host->base);
 
Signature · 1 line
2.39.0
maintainer Applied
#4 lore raw

Re: [PATCH 03/18] mtd: rawnand: mxc: Convert to devm_platform_ioremap_resource()

Quoted 3 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author
#5 lore raw

PATCH 4/18 mtd: rawnand: sh_flctl: Use devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/mtd/nand/raw/sh_flctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/raw/sh_flctl.c +1 -2
index 63bf20c41719..db243b54c953 100644
@@ -1124,8 +1124,7 @@ static int flctl_probe(struct platform_device *pdev)
 	if (!flctl)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	flctl->reg = devm_ioremap_resource(&pdev->dev, res);
+	flctl->reg = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(flctl->reg))
 		return PTR_ERR(flctl->reg);
 	flctl->fifo = res->start + 0x24; /* FLDTFIFO */
Signature · 1 line
2.39.0
maintainer Applied
#6 lore raw

Re: [PATCH 04/18] mtd: rawnand: sh_flctl: Use devm_platform_get_and_ioremap_resource()

Quoted 5 lines · Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author
#7 lore raw

PATCH 5/18 mtd: rawnand: omap2: Use devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/mtd/nand/raw/omap2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/raw/omap2.c +1 -2
index db22b3af16d8..277d16f1e0bb 100644
@@ -2219,8 +2219,7 @@ static int omap_nand_probe(struct platform_device *pdev)
 		}
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	vaddr = devm_ioremap_resource(&pdev->dev, res);
+	vaddr = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(vaddr))
 		return PTR_ERR(vaddr);
 
Signature · 1 line
2.39.0
maintainer Applied
#8 lore raw

Re: [PATCH 05/18] mtd: rawnand: omap2: Use devm_platform_get_and_ioremap_resource()

Quoted 5 lines · Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author
#9 lore raw

PATCH 6/18 mtd: rawnand: stm32_fmc2: Use devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/mtd/nand/raw/stm32_fmc2_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/stm32_fmc2_nand.c +2 -2
index 10c11cecac08..2f9e43f64dd7 100644
@@ -1922,8 +1922,8 @@ static int stm32_fmc2_nfc_probe(struct platform_device *pdev)
 		if (!(nfc->cs_assigned & BIT(chip_cs)))
 			continue;
 
-		res = platform_get_resource(pdev, IORESOURCE_MEM, mem_region);
-		nfc->data_base[chip_cs] = devm_ioremap_resource(dev, res);
+		nfc->data_base[chip_cs] = devm_platform_get_and_ioremap_resource(pdev,
+						mem_region, &res);
 		if (IS_ERR(nfc->data_base[chip_cs]))
 			return PTR_ERR(nfc->data_base[chip_cs]);
 
Signature · 1 line
2.39.0
maintainer Applied
#10 lore raw

Re: [PATCH 06/18] mtd: rawnand: stm32_fmc2: Use devm_platform_get_and_ioremap_resource()

Quoted 5 lines · Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author
#11 lore raw

PATCH 7/18 mtd: rawnand: lpc32xx_mlc: Use devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/mtd/nand/raw/lpc32xx_mlc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/raw/lpc32xx_mlc.c +1 -2
index b3136ae6f4e9..488fd452611a 100644
@@ -695,8 +695,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
 
 	host->pdev = pdev;
 
-	rc = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	host->io_base = devm_ioremap_resource(&pdev->dev, rc);
+	host->io_base = devm_platform_get_and_ioremap_resource(pdev, 0, &rc);
 	if (IS_ERR(host->io_base))
 		return PTR_ERR(host->io_base);
 
Signature · 1 line
2.39.0
maintainer Applied
#12 lore raw

Re: [PATCH 07/18] mtd: rawnand: lpc32xx_mlc: Use devm_platform_get_and_ioremap_resource()

Quoted 5 lines · Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author
#13 lore raw

PATCH 8/18 mtd: rawnand: fsl_upm: Use devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/mtd/nand/raw/fsl_upm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/raw/fsl_upm.c +1 -2
index 086426139173..f1810e2f2c07 100644
@@ -172,8 +172,7 @@ static int fun_probe(struct platform_device *ofdev)
 	if (!fun)
 		return -ENOMEM;
 
-	io_res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
-	fun->io_base = devm_ioremap_resource(&ofdev->dev, io_res);
+	fun->io_base = devm_platform_get_and_ioremap_resource(ofdev, 0, &io_res);
 	if (IS_ERR(fun->io_base))
 		return PTR_ERR(fun->io_base);
 
Signature · 6 lines
2.39.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
maintainer Applied
#14 lore raw

Re: [PATCH 08/18] mtd: rawnand: fsl_upm: Use devm_platform_get_and_ioremap_resource()

Quoted 5 lines · Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author
#15 lore raw

PATCH 9/18 mtd: rawnand: davinci: Convert to devm_platform_ioremap_resource()

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mtd/nand/raw/davinci_nand.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)
drivers/mtd/nand/raw/davinci_nand.c +9 -12
index 415d6aaa8255..2db1cd1d3d03 100644
@@ -710,8 +710,7 @@ static int nand_davinci_probe(struct platform_device *pdev)
 {
 	struct davinci_nand_pdata	*pdata;
 	struct davinci_nand_info	*info;
-	struct resource			*res1;
-	struct resource			*res2;
+	struct resource			*res;
 	void __iomem			*vaddr;
 	void __iomem			*base;
 	int				ret;
@@ -736,26 +735,24 @@ static int nand_davinci_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, info);
 
-	res1 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (!res1 || !res2) {
-		dev_err(&pdev->dev, "resource missing\n");
-		return -EINVAL;
-	}
-
-	vaddr = devm_ioremap_resource(&pdev->dev, res1);
+	vaddr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(vaddr))
 		return PTR_ERR(vaddr);
 
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	if (!res) {
+		dev_err(&pdev->dev, "resource missing\n");
+		return -EINVAL;
+	}
 	/*
 	 * This registers range is used to setup NAND settings. In case with
 	 * TI AEMIF driver, the same memory address range is requested already
 	 * by AEMIF, so we cannot request it twice, just ioremap.
 	 * The AEMIF and NAND drivers not use the same registers in this range.
 	 */
-	base = devm_ioremap(&pdev->dev, res2->start, resource_size(res2));
+	base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
 	if (!base) {
-		dev_err(&pdev->dev, "ioremap failed for resource %pR\n", res2);
+		dev_err(&pdev->dev, "ioremap failed for resource %pR\n", res);
 		return -EADDRNOTAVAIL;
 	}
 
Signature · 6 lines
2.39.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
maintainer
#16 lore raw

Re: [PATCH 09/18] mtd: rawnand: davinci: Convert to devm_platform_ioremap_resource()

Hi Yangtao,

[email protected] wrote on Fri, 7 Jul 2023 12:06:13 +0800:

Quoted 43 lines

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mtd/nand/raw/davinci_nand.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)
drivers/mtd/nand/raw/davinci_nand.c +7 -10
index 415d6aaa8255..2db1cd1d3d03 100644
@@ -710,8 +710,7 @@ static int nand_davinci_probe(struct platform_device *pdev)
 {
 	struct davinci_nand_pdata	*pdata;
 	struct davinci_nand_info	*info;
-	struct resource			*res1;
-	struct resource			*res2;
+	struct resource			*res;
 	void __iomem			*vaddr;
 	void __iomem			*base;
 	int				ret;
@@ -736,26 +735,24 @@ static int nand_davinci_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, info);
 
-	res1 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (!res1 || !res2) {
-		dev_err(&pdev->dev, "resource missing\n");
-		return -EINVAL;
-	}
-
-	vaddr = devm_ioremap_resource(&pdev->dev, res1);
+	vaddr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(vaddr))
 		return PTR_ERR(vaddr);
 
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	if (!res) {
+		dev_err(&pdev->dev, "resource missing\n");
+		return -EINVAL;
+	}
 	/*

drivers/mtd/nand/raw/davinci_nand.c static int nand_davinci_probe(struct platform_device *pdev) · line 755

Quoted 10 lines
drivers/mtd/nand/raw/davinci_nand.c +2 -2
 	 * This registers range is used to setup NAND settings. In case with
 	 * TI AEMIF driver, the same memory address range is requested already
 	 * by AEMIF, so we cannot request it twice, just ioremap.
 	 * The AEMIF and NAND drivers not use the same registers in this range.
 	 */
-	base = devm_ioremap(&pdev->dev, res2->start, resource_size(res2));
+	base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
 	if (!base) {
-		dev_err(&pdev->dev, "ioremap failed for resource %pR\n", res2);
+		dev_err(&pdev->dev, "ioremap failed for resource %pR\n", res);

I believe this is the only use of the resource, I am in favor of just using the regular devm_platform_ioremap_resource() helper here and just drop the reference to the resource from the message.

I will apply all other patches, please send a v2 only for this one once improved.

drivers/mtd/nand/raw/davinci_nand.c static int nand_davinci_probe(struct platform_device *pdev) · line 758

Quoted 3 lines
drivers/mtd/nand/raw/davinci_nand.c +0 -0
 		return -EADDRNOTAVAIL;
 	}
 

Thanks,
Miquèl

author
#17 lore raw

Re: [PATCH 09/18] mtd: rawnand: davinci: Convert to devm_platform_ioremap_resource()

Hi Mique,

Quoted 52 lines · Miquel Raynal

Hi Yangtao,

[email protected] wrote on Fri, 7 Jul 2023 12:06:13 +0800:

Quoted 48 lines

Use devm_platform_ioremap_resource() to simplify code.

---
  drivers/mtd/nand/raw/davinci_nand.c | 21 +++++++++------------
  1 file changed, 9 insertions(+), 12 deletions(-)
drivers/mtd/nand/raw/davinci_nand.c +7 -10
index 415d6aaa8255..2db1cd1d3d03 100644
@@ -710,8 +710,7 @@ static int nand_davinci_probe(struct platform_device *pdev)
  {
  	struct davinci_nand_pdata	*pdata;
  	struct davinci_nand_info	*info;
-	struct resource			*res1;
-	struct resource			*res2;
+	struct resource			*res;
  	void __iomem			*vaddr;
  	void __iomem			*base;
  	int				ret;
@@ -736,26 +735,24 @@ static int nand_davinci_probe(struct platform_device *pdev)
 
  	platform_set_drvdata(pdev, info);
 
-	res1 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (!res1 || !res2) {
-		dev_err(&pdev->dev, "resource missing\n");
-		return -EINVAL;
-	}
-
-	vaddr = devm_ioremap_resource(&pdev->dev, res1);
+	vaddr = devm_platform_ioremap_resource(pdev, 0);
  	if (IS_ERR(vaddr))
  		return PTR_ERR(vaddr);
 
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	if (!res) {
+		dev_err(&pdev->dev, "resource missing\n");
+		return -EINVAL;
+	}
  	/*
  	 * This registers range is used to setup NAND settings. In case with
  	 * TI AEMIF driver, the same memory address range is requested already
  	 * by AEMIF, so we cannot request it twice, just ioremap.
  	 * The AEMIF and NAND drivers not use the same registers in this range.
  	 */
Quoted 8 lines

drivers/mtd/nand/raw/davinci_nand.c static int nand_davinci_probe(struct platform_device *pdev) · line 755

Quoted 5 lines
drivers/mtd/nand/raw/davinci_nand.c +2 -2
-	base = devm_ioremap(&pdev->dev, res2->start, resource_size(res2));
+	base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
  	if (!base) {
-		dev_err(&pdev->dev, "ioremap failed for resource %pR\n", res2);
+		dev_err(&pdev->dev, "ioremap failed for resource %pR\n", res);

I believe this is the only use of the resource, I am in favor of just using the regular devm_platform_ioremap_resource() helper here and just drop the reference to the resource from the message.

I guess maybe you can apply this patch directly?

It should be noted that devm_ioremap_resource is not the same as devm_ioremap,

here is devm_ioremap (devm_request_mem_region will not be called, and there are comments explaining why this interface is needed),

which means that we cannot simply replace it with devm_platform_ioremap_resource.

MBR,

Yangtao

Quoted 10 lines

I will apply all other patches, please send a v2 only for this one once improved.

drivers/mtd/nand/raw/davinci_nand.c static int nand_davinci_probe(struct platform_device *pdev) · line 758

Quoted 3 lines
drivers/mtd/nand/raw/davinci_nand.c +0 -0
  		return -EADDRNOTAVAIL;
  	}
 

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author
#18 lore raw

Re: [PATCH 09/18] mtd: rawnand: davinci: Convert to devm_platform_ioremap_resource()

In reply to Miquel Raynal
Quoted 3 lines

I believe this is the only use of the resource, I am in favor of just using the regular devm_platform_ioremap_resource() helper here and just drop the reference to the resource from the message.

I guess maybe you can apply this patch directly?

It should be noted that devm_ioremap_resource is not the same as devm_ioremap,
here is devm_ioremap (devm_request_mem_region will not be called, and there are comments explaining why this interface is needed), which means that we cannot simply replace it with devm_platform_ioremap_resource.

MBR,
Yangtao

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author
#19 lore raw

PATCH 10/18 mtd: rawnand: atmel: Use devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/mtd/nand/raw/atmel/nand-controller.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/raw/atmel/nand-controller.c +1 -2
index 81e3d682a8cd..3f494f7c7ecb 100644
@@ -1791,8 +1791,7 @@ atmel_nand_controller_legacy_add_nands(struct atmel_nand_controller *nc)
 
 	nand->numcs = 1;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	nand->cs[0].io.virt = devm_ioremap_resource(dev, res);
+	nand->cs[0].io.virt = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(nand->cs[0].io.virt))
 		return PTR_ERR(nand->cs[0].io.virt);
 
Signature · 6 lines
2.39.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
maintainer Applied
#20 lore raw

Re: [PATCH 10/18] mtd: rawnand: atmel: Use devm_platform_get_and_ioremap_resource()

Quoted 5 lines · Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author
#21 lore raw

PATCH 11/18 mtd: nand: samsung: Convert to devm_platform_ioremap_resource() and devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Use devm_platform_ioremap_resource() and devm_platform_get_and_ioremap_resource() to simplify code.

---
 drivers/mtd/nand/onenand/onenand_samsung.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/mtd/nand/onenand/onenand_samsung.c +3 -6
index 92151aa52964..fd6890a03d55 100644
@@ -860,8 +860,7 @@ static int s3c_onenand_probe(struct platform_device *pdev)
 
 	s3c_onenand_setup(mtd);
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	onenand->base = devm_ioremap_resource(&pdev->dev, r);
+	onenand->base = devm_platform_get_and_ioremap_resource(pdev, 0, &r);
 	if (IS_ERR(onenand->base))
 		return PTR_ERR(onenand->base);
 
@@ -874,8 +873,7 @@ static int s3c_onenand_probe(struct platform_device *pdev)
 	this->options |= ONENAND_SKIP_UNLOCK_CHECK;
 
 	if (onenand->type != TYPE_S5PC110) {
-		r = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-		onenand->ahb_addr = devm_ioremap_resource(&pdev->dev, r);
+		onenand->ahb_addr = devm_platform_ioremap_resource(pdev, 1);
 		if (IS_ERR(onenand->ahb_addr))
 			return PTR_ERR(onenand->ahb_addr);
 
@@ -895,8 +893,7 @@ static int s3c_onenand_probe(struct platform_device *pdev)
 		this->subpagesize = mtd->writesize;
 
 	} else { /* S5PC110 */
-		r = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-		onenand->dma_addr = devm_ioremap_resource(&pdev->dev, r);
+		onenand->dma_addr = devm_platform_ioremap_resource(pdev, 1);
 		if (IS_ERR(onenand->dma_addr))
 			return PTR_ERR(onenand->dma_addr);
 
Signature · 6 lines
2.39.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
maintainer Applied
#22 lore raw

Re: [PATCH 11/18] mtd: nand: samsung: Convert to devm_platform_ioremap_resource() and devm_platform_get_and_ioremap_resource()

Quoted 4 lines · Yangtao Li

Use devm_platform_ioremap_resource() and devm_platform_get_and_ioremap_resource() to simplify code.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author
#23 lore raw

PATCH 12/18 mtd: nand: omap: Use devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/mtd/nand/onenand/onenand_omap2.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/mtd/nand/onenand/onenand_omap2.c +3 -9
index ff7af98604df..b39aee023103 100644
@@ -467,11 +467,9 @@ static int omap2_onenand_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(dev, "error getting memory resource\n");
-		return -EINVAL;
-	}
+	c->onenand.base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
+	if (IS_ERR(c->onenand.base))
+		return PTR_ERR(c->onenand.base);
 
 	r = of_property_read_u32(np, "reg", &val);
 	if (r) {
@@ -488,10 +486,6 @@ static int omap2_onenand_probe(struct platform_device *pdev)
 	c->gpmc_cs = val;
 	c->phys_base = res->start;
 
-	c->onenand.base = devm_ioremap_resource(dev, res);
-	if (IS_ERR(c->onenand.base))
-		return PTR_ERR(c->onenand.base);
-
 	c->int_gpiod = devm_gpiod_get_optional(dev, "int", GPIOD_IN);
 	if (IS_ERR(c->int_gpiod)) {
 		/* Just try again if this happens */
Signature · 6 lines
2.39.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
maintainer Applied
#24 lore raw

Re: [PATCH 12/18] mtd: nand: omap: Use devm_platform_get_and_ioremap_resource()

Quoted 5 lines · Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#25 lore raw

Re: [PATCH 12/18] mtd: nand: omap: Use devm_platform_get_and_ioremap_resource()

Quoted 8 lines · Miquel Raynal
Quoted 5 lines · Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Please apply the updated version at [1], the current version is obviously not correct, as clang points out in next-20230714:

drivers/mtd/nand/onenand/onenand_omap2.c:470:2: warning: variable 'c' is uninitialized when used here [-Wuninitialized]

    470 |         c->onenand.base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
        |         ^
  drivers/mtd/nand/onenand/onenand_omap2.c:465:25: note: initialize the variable 'c' to silence this warning
    465 |         struct omap2_onenand *c;
        |                                ^
        |                                 = NULL

1 warning generated.

KernelCI also reported this at [2]. I apologize if this has already been reported or fixed locally, I did not see your branch updated.

[1]: https://lore.kernel.org/[email protected]/
[2]: https://lore.kernel.org/[email protected]/

Cheers,
Nathan

maintainer
#26 lore raw

Re: [PATCH 12/18] mtd: nand: omap: Use devm_platform_get_and_ioremap_resource()

Hi Nathan,

[email protected] wrote on Fri, 14 Jul 2023 08:27:01 -0700:

Quoted 6 lines · Miquel Raynal
Quoted 5 lines · Yangtao Li
Quoted 4 lines

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Please apply the updated version at [1], the current version is obviously not correct, as clang points out in next-20230714:

I will replace the first version by the corrected one.

Quoted 10 lines

drivers/mtd/nand/onenand/onenand_omap2.c:470:2: warning: variable 'c' is uninitialized when used here [-Wuninitialized]

    470 |         c->onenand.base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
        |         ^
  drivers/mtd/nand/onenand/onenand_omap2.c:465:25: note: initialize the variable 'c' to silence this warning
    465 |         struct omap2_onenand *c;
        |                                ^
        |                                 = NULL

1 warning generated.

Quoted 8 lines

KernelCI also reported this at [2]. I apologize if this has already been reported or fixed locally, I did not see your branch updated.

[1]: https://lore.kernel.org/[email protected]/
[2]: https://lore.kernel.org/[email protected]/

Cheers,
Nathan

Thanks,
Miquèl

author
#27 lore raw

PATCH 13/18 mtd: plat-ram: Use devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/mtd/maps/plat-ram.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/maps/plat-ram.c +1 -2
index cedd8ef9a6bf..4c921dce7396 100644
@@ -123,8 +123,7 @@ static int platram_probe(struct platform_device *pdev)
 	info->pdata = pdata;
 
 	/* get the resource for the memory mapping */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	info->map.virt = devm_ioremap_resource(&pdev->dev, res);
+	info->map.virt = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(info->map.virt)) {
 		err = PTR_ERR(info->map.virt);
 		goto exit_free;
Signature · 6 lines
2.39.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
maintainer Applied
#28 lore raw

Re: [PATCH 13/18] mtd: plat-ram: Use devm_platform_get_and_ioremap_resource()

Quoted 5 lines · Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author
#29 lore raw

PATCH 14/18 mtd: lantiq-flash: Use devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/mtd/maps/lantiq-flash.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/mtd/maps/lantiq-flash.c +3 -8
index 67a1dbfdd72c..a1da1c8973c0 100644
@@ -118,11 +118,9 @@ ltq_mtd_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, ltq_mtd);
 
-	ltq_mtd->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!ltq_mtd->res) {
-		dev_err(&pdev->dev, "failed to get memory resource\n");
-		return -ENOENT;
-	}
+	ltq_mtd->map->virt = devm_platform_get_and_ioremap_resource(pdev, 0, &ltq_mtd->res);
+	if (IS_ERR(ltq_mtd->map->virt))
+		return PTR_ERR(ltq_mtd->map->virt);
 
 	ltq_mtd->map = devm_kzalloc(&pdev->dev, sizeof(struct map_info),
 				    GFP_KERNEL);
@@ -131,9 +129,6 @@ ltq_mtd_probe(struct platform_device *pdev)
 
 	ltq_mtd->map->phys = ltq_mtd->res->start;
 	ltq_mtd->map->size = resource_size(ltq_mtd->res);
-	ltq_mtd->map->virt = devm_ioremap_resource(&pdev->dev, ltq_mtd->res);
-	if (IS_ERR(ltq_mtd->map->virt))
-		return PTR_ERR(ltq_mtd->map->virt);
 
 	ltq_mtd->map->name = ltq_map_name;
 	ltq_mtd->map->bankwidth = 2;
Signature · 6 lines
2.39.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
maintainer Applied
#30 lore raw

Re: [PATCH 14/18] mtd: lantiq-flash: Use devm_platform_get_and_ioremap_resource()

Quoted 5 lines · Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author
#31 lore raw

PATCH 15/18 mtd: lpddr2_nvm: Convert to devm_platform_ioremap_resource()

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mtd/lpddr/lpddr2_nvm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mtd/lpddr/lpddr2_nvm.c +1 -3
index e71af4c49096..f4e5174b2449 100644
@@ -412,7 +412,6 @@ static int lpddr2_nvm_probe(struct platform_device *pdev)
 	struct map_info *map;
 	struct mtd_info *mtd;
 	struct resource *add_range;
-	struct resource *control_regs;
 	struct pcm_int_data *pcm_data;
 
 	/* Allocate memory control_regs data structures */
@@ -452,8 +451,7 @@ static int lpddr2_nvm_probe(struct platform_device *pdev)
 
 	simple_map_init(map);	/* fill with default methods */
 
-	control_regs = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	pcm_data->ctl_regs = devm_ioremap_resource(&pdev->dev, control_regs);
+	pcm_data->ctl_regs = devm_platform_ioremap_resource(pdev, 1);
 	if (IS_ERR(pcm_data->ctl_regs))
 		return PTR_ERR(pcm_data->ctl_regs);
 
Signature · 6 lines
2.39.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
author
#33 lore raw

PATCH 16/18 mtd: st_spi_fsm: Convert to devm_platform_ioremap_resource()

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mtd/devices/st_spi_fsm.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/mtd/devices/st_spi_fsm.c +2 -12
index 3dbb1aa80bfa..95530cbbb1e0 100644
@@ -2016,7 +2016,6 @@ static int stfsm_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct flash_info *info;
-	struct resource *res;
 	struct stfsm *fsm;
 	int ret;
 
@@ -2033,18 +2032,9 @@ static int stfsm_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, fsm);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "Resource not found\n");
-		return -ENODEV;
-	}
-
-	fsm->base = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(fsm->base)) {
-		dev_err(&pdev->dev,
-			"Failed to reserve memory region %pR\n", res);
+	fsm->base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(fsm->base))
 		return PTR_ERR(fsm->base);
-	}
 
 	fsm->clk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(fsm->clk)) {
Signature · 6 lines
2.39.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
author
#35 lore raw

PATCH 17/18 mtd: spear_smi: Convert to devm_platform_ioremap_resource()

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/mtd/devices/spear_smi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mtd/devices/spear_smi.c +1 -4
index cc17133be297..93bca5225116 100644
@@ -937,7 +937,6 @@ static int spear_smi_probe(struct platform_device *pdev)
 	struct device_node *np = pdev->dev.of_node;
 	struct spear_smi_plat_data *pdata = NULL;
 	struct spear_smi *dev;
-	struct resource *smi_base;
 	int irq, ret = 0;
 	int i;
 
@@ -975,9 +974,7 @@ static int spear_smi_probe(struct platform_device *pdev)
 		goto err;
 	}
 
-	smi_base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
-	dev->io_base = devm_ioremap_resource(&pdev->dev, smi_base);
+	dev->io_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(dev->io_base)) {
 		ret = PTR_ERR(dev->io_base);
 		goto err;
Signature · 6 lines
2.39.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
author
#37 lore raw

PATCH 18/18 mtd: physmap-core: Use devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/mtd/maps/physmap-core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/maps/physmap-core.c +1 -2
index c73854da5136..78710fbc8e7f 100644
@@ -508,8 +508,7 @@ static int physmap_flash_probe(struct platform_device *dev)
 	for (i = 0; i < info->nmaps; i++) {
 		struct resource *res;
 
-		res = platform_get_resource(dev, IORESOURCE_MEM, i);
-		info->maps[i].virt = devm_ioremap_resource(&dev->dev, res);
+		info->maps[i].virt = devm_platform_get_and_ioremap_resource(dev, i, &res);
 		if (IS_ERR(info->maps[i].virt)) {
 			err = PTR_ERR(info->maps[i].virt);
 			goto err_out;
Signature · 6 lines
2.39.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
maintainer Acked-by on v1 1/18
#39 lore raw
In reply to Yangtao Li

Dne petek, 07. julij 2023 ob 06:06:05 CEST je Yangtao Li napisal(a):

Quoted 5 lines

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

Best regards,
Jernej

Quoted 17 lines
---
 drivers/mtd/nand/raw/sunxi_nand.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/mtd/nand/raw/sunxi_nand.c index 9884304634f6..db36bd755b8d 100644

drivers/mtd/nand/raw/sunxi_nand.c +1 -2
@@ -2087,8 +2087,7 @@ static int sunxi_nfc_probe(struct platform_device
 *pdev) nand_controller_init(&nfc->controller);
 	INIT_LIST_HEAD(&nfc->chips);
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	nfc->regs = devm_ioremap_resource(dev, r);
+	nfc->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &r);
 	if (IS_ERR(nfc->regs))
 		return PTR_ERR(nfc->regs);
maintainer
#40 lore raw
In reply to Yangtao Li

Hi Yangtao,

[email protected] wrote on Fri, 7 Jul 2023 12:06:05 +0800:

Quoted 14 lines

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/mtd/nand/raw/sunxi_nand.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/raw/sunxi_nand.c +0 -0
index 9884304634f6..db36bd755b8d 100644

drivers/mtd/nand/raw/sunxi_nand.c static int sunxi_nfc_probe(struct platform_device *pdev) · line 2090

Quoted 6 lines
drivers/mtd/nand/raw/sunxi_nand.c +1 -2
@@ -2087,8 +2087,7 @@ static int sunxi_nfc_probe(struct platform_device *pdev)
 	nand_controller_init(&nfc->controller);
 	INIT_LIST_HEAD(&nfc->chips);
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	nfc->regs = devm_ioremap_resource(dev, r);
+	nfc->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &r);

Why do you keep a reference over the resource? Why not just devm_platform_ioremap_resource(pdev, 0) ?

This comment is valid for almost all the cases in this series.

When the resource is only needed in an error printk, I am also in favor of modifying the error message to avoid having to grab the resource.

drivers/mtd/nand/raw/sunxi_nand.c static int sunxi_nfc_probe(struct platform_device *pdev) · line 2093

Quoted 3 lines
drivers/mtd/nand/raw/sunxi_nand.c +0 -0
 	if (IS_ERR(nfc->regs))
 		return PTR_ERR(nfc->regs);
 

These comments apply to the 18 patches.

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

maintainer
#41 lore raw

[email protected] wrote on Wed, 12 Jul 2023 13:54:55 +0200:

Quoted 21 lines

Hi Yangtao,

[email protected] wrote on Fri, 7 Jul 2023 12:06:05 +0800:

Quoted 17 lines

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/mtd/nand/raw/sunxi_nand.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/raw/sunxi_nand.c +0 -0
index 9884304634f6..db36bd755b8d 100644
@@ -2087,8 +2087,7 @@ static int sunxi_nfc_probe(struct platform_device *pdev)
 	nand_controller_init(&nfc->controller);
 	INIT_LIST_HEAD(&nfc->chips);
 
Quoted 8 lines

drivers/mtd/nand/raw/sunxi_nand.c static int sunxi_nfc_probe(struct platform_device *pdev) · line 2090

Quoted 3 lines
drivers/mtd/nand/raw/sunxi_nand.c +1 -2
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	nfc->regs = devm_ioremap_resource(dev, r);
+	nfc->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &r);

Why do you keep a reference over the resource? Why not just devm_platform_ioremap_resource(pdev, 0) ?

This comment is valid for almost all the cases in this series.

Actually 'r' is used at the bottom, so the patch is good. I reviewed all the patches, 17 look right, I have a minor comment on one of them. In order to avoid resending all the patches, I'll first apply the 17 good ones and ask you to resend just the last one.

Quoted 11 lines

When the resource is only needed in an error printk, I am also in favor of modifying the error message to avoid having to grab the resource.

drivers/mtd/nand/raw/sunxi_nand.c static int sunxi_nfc_probe(struct platform_device *pdev) · line 2093

Quoted 3 lines
drivers/mtd/nand/raw/sunxi_nand.c +0 -0
 	if (IS_ERR(nfc->regs))
 		return PTR_ERR(nfc->regs);
 

These comments apply to the 18 patches.

Thanks,
Miquèl

Thanks,
Miquèl