* [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource()
@ 2023-07-07 4:06 Yangtao Li
2023-07-07 4:06 ` [PATCH 02/18] mtd: rawnand: lpc32xx_slc: " Yangtao Li
` (19 more replies)
0 siblings, 20 replies; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
Cc: Yangtao Li, linux-mtd, linux-arm-kernel, linux-sunxi,
linux-kernel
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.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/nand/raw/sunxi_nand.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
index 9884304634f6..db36bd755b8d 100644
--- a/drivers/mtd/nand/raw/sunxi_nand.c
+++ b/drivers/mtd/nand/raw/sunxi_nand.c
@@ -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);
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 02/18] mtd: rawnand: lpc32xx_slc: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 03/18] mtd: rawnand: mxc: Convert to devm_platform_ioremap_resource() Yangtao Li
` (18 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Vladimir Zapolskiy
Cc: Yangtao Li, linux-mtd, linux-arm-kernel, linux-kernel
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.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/nand/raw/lpc32xx_slc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/lpc32xx_slc.c b/drivers/mtd/nand/raw/lpc32xx_slc.c
index 3139b6107660..2201264d3c37 100644
--- a/drivers/mtd/nand/raw/lpc32xx_slc.c
+++ b/drivers/mtd/nand/raw/lpc32xx_slc.c
@@ -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);
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 03/18] mtd: rawnand: mxc: Convert to devm_platform_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-07 4:06 ` [PATCH 02/18] mtd: rawnand: lpc32xx_slc: " Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 04/18] mtd: rawnand: sh_flctl: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (17 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: Yangtao Li, linux-mtd, linux-kernel
Use devm_platform_ioremap_resource() to simplify code.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/nand/raw/mxc_nand.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c
index 3d4b2e8294ea..2f8dcda0f435 100644
--- a/drivers/mtd/nand/raw/mxc_nand.c
+++ b/drivers/mtd/nand/raw/mxc_nand.c
@@ -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);
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 04/18] mtd: rawnand: sh_flctl: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-07 4:06 ` [PATCH 02/18] mtd: rawnand: lpc32xx_slc: " Yangtao Li
2023-07-07 4:06 ` [PATCH 03/18] mtd: rawnand: mxc: Convert to devm_platform_ioremap_resource() Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 05/18] mtd: rawnand: omap2: " Yangtao Li
` (16 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: Yangtao Li, linux-mtd, linux-kernel
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.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/nand/raw/sh_flctl.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/sh_flctl.c b/drivers/mtd/nand/raw/sh_flctl.c
index 63bf20c41719..db243b54c953 100644
--- a/drivers/mtd/nand/raw/sh_flctl.c
+++ b/drivers/mtd/nand/raw/sh_flctl.c
@@ -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 */
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 05/18] mtd: rawnand: omap2: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (2 preceding siblings ...)
2023-07-07 4:06 ` [PATCH 04/18] mtd: rawnand: sh_flctl: Use devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 06/18] mtd: rawnand: stm32_fmc2: " Yangtao Li
` (15 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: Yangtao Li, linux-mtd, linux-kernel
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.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/nand/raw/omap2.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/omap2.c b/drivers/mtd/nand/raw/omap2.c
index db22b3af16d8..277d16f1e0bb 100644
--- a/drivers/mtd/nand/raw/omap2.c
+++ b/drivers/mtd/nand/raw/omap2.c
@@ -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);
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 06/18] mtd: rawnand: stm32_fmc2: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (3 preceding siblings ...)
2023-07-07 4:06 ` [PATCH 05/18] mtd: rawnand: omap2: " Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 07/18] mtd: rawnand: lpc32xx_mlc: " Yangtao Li
` (14 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Maxime Coquelin, Alexandre Torgue
Cc: Yangtao Li, linux-mtd, linux-stm32, linux-arm-kernel,
linux-kernel
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.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/nand/raw/stm32_fmc2_nand.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
index 10c11cecac08..2f9e43f64dd7 100644
--- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c
+++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
@@ -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]);
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 07/18] mtd: rawnand: lpc32xx_mlc: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (4 preceding siblings ...)
2023-07-07 4:06 ` [PATCH 06/18] mtd: rawnand: stm32_fmc2: " Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 08/18] mtd: rawnand: fsl_upm: " Yangtao Li
` (13 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Vladimir Zapolskiy
Cc: Yangtao Li, linux-mtd, linux-arm-kernel, linux-kernel
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.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/nand/raw/lpc32xx_mlc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/lpc32xx_mlc.c b/drivers/mtd/nand/raw/lpc32xx_mlc.c
index b3136ae6f4e9..488fd452611a 100644
--- a/drivers/mtd/nand/raw/lpc32xx_mlc.c
+++ b/drivers/mtd/nand/raw/lpc32xx_mlc.c
@@ -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);
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 08/18] mtd: rawnand: fsl_upm: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (5 preceding siblings ...)
2023-07-07 4:06 ` [PATCH 07/18] mtd: rawnand: lpc32xx_mlc: " Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 09/18] mtd: rawnand: davinci: Convert to devm_platform_ioremap_resource() Yangtao Li
` (12 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: Yangtao Li, linux-mtd, linux-kernel
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.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/nand/raw/fsl_upm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/fsl_upm.c b/drivers/mtd/nand/raw/fsl_upm.c
index 086426139173..f1810e2f2c07 100644
--- a/drivers/mtd/nand/raw/fsl_upm.c
+++ b/drivers/mtd/nand/raw/fsl_upm.c
@@ -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);
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 09/18] mtd: rawnand: davinci: Convert to devm_platform_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (6 preceding siblings ...)
2023-07-07 4:06 ` [PATCH 08/18] mtd: rawnand: fsl_upm: " Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-12 12:09 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 10/18] mtd: rawnand: atmel: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (11 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: Yangtao Li, linux-mtd, linux-kernel
Use devm_platform_ioremap_resource() to simplify code.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/nand/raw/davinci_nand.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
index 415d6aaa8255..2db1cd1d3d03 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -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;
}
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 10/18] mtd: rawnand: atmel: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (7 preceding siblings ...)
2023-07-07 4:06 ` [PATCH 09/18] mtd: rawnand: davinci: Convert to devm_platform_ioremap_resource() Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-13 7:57 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 11/18] mtd: nand: samsung: Convert to devm_platform_ioremap_resource() and devm_platform_get_and_ioremap_resource() Yangtao Li
` (10 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Tudor Ambarus, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea
Cc: Yangtao Li, linux-mtd, linux-arm-kernel, linux-kernel
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.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/nand/raw/atmel/nand-controller.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
index 81e3d682a8cd..3f494f7c7ecb 100644
--- a/drivers/mtd/nand/raw/atmel/nand-controller.c
+++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
@@ -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);
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 11/18] mtd: nand: samsung: Convert to devm_platform_ioremap_resource() and devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (8 preceding siblings ...)
2023-07-07 4:06 ` [PATCH 10/18] mtd: rawnand: atmel: Use devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-13 7:57 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 12/18] mtd: nand: omap: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (9 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Kyungmin Park, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: Yangtao Li, linux-mtd, linux-kernel
Use devm_platform_ioremap_resource() and
devm_platform_get_and_ioremap_resource() to simplify code.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/nand/onenand/onenand_samsung.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/nand/onenand/onenand_samsung.c b/drivers/mtd/nand/onenand/onenand_samsung.c
index 92151aa52964..fd6890a03d55 100644
--- a/drivers/mtd/nand/onenand/onenand_samsung.c
+++ b/drivers/mtd/nand/onenand/onenand_samsung.c
@@ -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);
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 12/18] mtd: nand: omap: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (9 preceding siblings ...)
2023-07-07 4:06 ` [PATCH 11/18] mtd: nand: samsung: Convert to devm_platform_ioremap_resource() and devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-13 7:57 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 13/18] mtd: plat-ram: " Yangtao Li
` (8 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Kyungmin Park, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: Yangtao Li, linux-mtd, linux-kernel
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.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/nand/onenand/onenand_omap2.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/mtd/nand/onenand/onenand_omap2.c b/drivers/mtd/nand/onenand/onenand_omap2.c
index ff7af98604df..b39aee023103 100644
--- a/drivers/mtd/nand/onenand/onenand_omap2.c
+++ b/drivers/mtd/nand/onenand/onenand_omap2.c
@@ -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 */
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 13/18] mtd: plat-ram: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (10 preceding siblings ...)
2023-07-07 4:06 ` [PATCH 12/18] mtd: nand: omap: Use devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-12 14:13 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 14/18] mtd: lantiq-flash: " Yangtao Li
` (7 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: Yangtao Li, linux-mtd, linux-kernel
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.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/maps/plat-ram.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c
index cedd8ef9a6bf..4c921dce7396 100644
--- a/drivers/mtd/maps/plat-ram.c
+++ b/drivers/mtd/maps/plat-ram.c
@@ -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;
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 14/18] mtd: lantiq-flash: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (11 preceding siblings ...)
2023-07-07 4:06 ` [PATCH 13/18] mtd: plat-ram: " Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-12 14:13 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 15/18] mtd: lpddr2_nvm: Convert to devm_platform_ioremap_resource() Yangtao Li
` (6 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: Yangtao Li, linux-mtd, linux-kernel
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.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/maps/lantiq-flash.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c
index 67a1dbfdd72c..a1da1c8973c0 100644
--- a/drivers/mtd/maps/lantiq-flash.c
+++ b/drivers/mtd/maps/lantiq-flash.c
@@ -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, <q_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;
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 15/18] mtd: lpddr2_nvm: Convert to devm_platform_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (12 preceding siblings ...)
2023-07-07 4:06 ` [PATCH 14/18] mtd: lantiq-flash: " Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-12 14:13 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 16/18] mtd: st_spi_fsm: " Yangtao Li
` (5 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: Yangtao Li, linux-mtd, linux-kernel
Use devm_platform_ioremap_resource() to simplify code.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/lpddr/lpddr2_nvm.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/mtd/lpddr/lpddr2_nvm.c b/drivers/mtd/lpddr/lpddr2_nvm.c
index e71af4c49096..f4e5174b2449 100644
--- a/drivers/mtd/lpddr/lpddr2_nvm.c
+++ b/drivers/mtd/lpddr/lpddr2_nvm.c
@@ -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);
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 16/18] mtd: st_spi_fsm: Convert to devm_platform_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (13 preceding siblings ...)
2023-07-07 4:06 ` [PATCH 15/18] mtd: lpddr2_nvm: Convert to devm_platform_ioremap_resource() Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-12 14:13 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 17/18] mtd: spear_smi: " Yangtao Li
` (4 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: Yangtao Li, linux-mtd, linux-kernel
Use devm_platform_ioremap_resource() to simplify code.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/devices/st_spi_fsm.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c
index 3dbb1aa80bfa..95530cbbb1e0 100644
--- a/drivers/mtd/devices/st_spi_fsm.c
+++ b/drivers/mtd/devices/st_spi_fsm.c
@@ -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)) {
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 17/18] mtd: spear_smi: Convert to devm_platform_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (14 preceding siblings ...)
2023-07-07 4:06 ` [PATCH 16/18] mtd: st_spi_fsm: " Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-12 14:13 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 18/18] mtd: physmap-core: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (3 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: Yangtao Li, linux-mtd, linux-kernel
Use devm_platform_ioremap_resource() to simplify code.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/devices/spear_smi.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c
index cc17133be297..93bca5225116 100644
--- a/drivers/mtd/devices/spear_smi.c
+++ b/drivers/mtd/devices/spear_smi.c
@@ -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;
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 18/18] mtd: physmap-core: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (15 preceding siblings ...)
2023-07-07 4:06 ` [PATCH 17/18] mtd: spear_smi: " Yangtao Li
@ 2023-07-07 4:06 ` Yangtao Li
2023-07-12 14:13 ` Miquel Raynal
2023-07-11 18:23 ` [PATCH 01/18] mtd: rawnand: sunxi: " Jernej Škrabec
` (2 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Yangtao Li @ 2023-07-07 4:06 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: Yangtao Li, linux-mtd, linux-kernel
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.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mtd/maps/physmap-core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-core.c
index c73854da5136..78710fbc8e7f 100644
--- a/drivers/mtd/maps/physmap-core.c
+++ b/drivers/mtd/maps/physmap-core.c
@@ -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;
--
2.39.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 43+ messages in thread
* Re: [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (16 preceding siblings ...)
2023-07-07 4:06 ` [PATCH 18/18] mtd: physmap-core: Use devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-11 18:23 ` Jernej Škrabec
2023-07-12 11:54 ` Miquel Raynal
2023-07-13 7:58 ` Miquel Raynal
19 siblings, 0 replies; 43+ messages in thread
From: Jernej Škrabec @ 2023-07-11 18:23 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Chen-Yu Tsai, Samuel Holland, Yangtao Li
Cc: Yangtao Li, linux-mtd, linux-arm-kernel, linux-sunxi,
linux-kernel
Dne petek, 07. julij 2023 ob 06:06:05 CEST je Yangtao Li napisal(a):
> 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.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
> ---
> drivers/mtd/nand/raw/sunxi_nand.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/sunxi_nand.c
> b/drivers/mtd/nand/raw/sunxi_nand.c index 9884304634f6..db36bd755b8d 100644
> --- a/drivers/mtd/nand/raw/sunxi_nand.c
> +++ b/drivers/mtd/nand/raw/sunxi_nand.c
> @@ -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);
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (17 preceding siblings ...)
2023-07-11 18:23 ` [PATCH 01/18] mtd: rawnand: sunxi: " Jernej Škrabec
@ 2023-07-12 11:54 ` Miquel Raynal
2023-07-12 12:06 ` Miquel Raynal
2023-07-13 7:58 ` Miquel Raynal
19 siblings, 1 reply; 43+ messages in thread
From: Miquel Raynal @ 2023-07-12 11:54 UTC (permalink / raw)
To: Yangtao Li
Cc: Richard Weinberger, Vignesh Raghavendra, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, linux-mtd, linux-arm-kernel,
linux-sunxi, linux-kernel
Hi Yangtao,
frank.li@vivo.com wrote on Fri, 7 Jul 2023 12:06:05 +0800:
> 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.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> drivers/mtd/nand/raw/sunxi_nand.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
> index 9884304634f6..db36bd755b8d 100644
> --- a/drivers/mtd/nand/raw/sunxi_nand.c
> +++ b/drivers/mtd/nand/raw/sunxi_nand.c
> @@ -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.
> 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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource()
2023-07-12 11:54 ` Miquel Raynal
@ 2023-07-12 12:06 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-12 12:06 UTC (permalink / raw)
To: Yangtao Li
Cc: Richard Weinberger, Vignesh Raghavendra, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, linux-mtd, linux-arm-kernel,
linux-sunxi, linux-kernel
miquel.raynal@bootlin.com wrote on Wed, 12 Jul 2023 13:54:55 +0200:
> Hi Yangtao,
>
> frank.li@vivo.com wrote on Fri, 7 Jul 2023 12:06:05 +0800:
>
> > 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.
> >
> > Signed-off-by: Yangtao Li <frank.li@vivo.com>
> > ---
> > drivers/mtd/nand/raw/sunxi_nand.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
> > index 9884304634f6..db36bd755b8d 100644
> > --- a/drivers/mtd/nand/raw/sunxi_nand.c
> > +++ b/drivers/mtd/nand/raw/sunxi_nand.c
> > @@ -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.
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.
> 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.
>
> > if (IS_ERR(nfc->regs))
> > return PTR_ERR(nfc->regs);
> >
>
> These comments apply to the 18 patches.
>
> Thanks,
> Miquèl
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 09/18] mtd: rawnand: davinci: Convert to devm_platform_ioremap_resource()
2023-07-07 4:06 ` [PATCH 09/18] mtd: rawnand: davinci: Convert to devm_platform_ioremap_resource() Yangtao Li
@ 2023-07-12 12:09 ` Miquel Raynal
2023-07-13 8:14 ` Yangtao Li
2023-07-13 8:26 ` Yangtao Li
0 siblings, 2 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-12 12:09 UTC (permalink / raw)
To: Yangtao Li
Cc: Richard Weinberger, Vignesh Raghavendra, linux-mtd, linux-kernel
Hi Yangtao,
frank.li@vivo.com wrote on Fri, 7 Jul 2023 12:06:13 +0800:
> Use devm_platform_ioremap_resource() to simplify code.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> drivers/mtd/nand/raw/davinci_nand.c | 21 +++++++++------------
> 1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
> index 415d6aaa8255..2db1cd1d3d03 100644
> --- a/drivers/mtd/nand/raw/davinci_nand.c
> +++ b/drivers/mtd/nand/raw/davinci_nand.c
> @@ -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);
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.
> return -EADDRNOTAVAIL;
> }
>
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 18/18] mtd: physmap-core: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 ` [PATCH 18/18] mtd: physmap-core: Use devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-12 14:13 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-12 14:13 UTC (permalink / raw)
To: Yangtao Li, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: linux-mtd, linux-kernel
On Fri, 2023-07-07 at 04:06:22 UTC, Yangtao Li wrote:
> 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.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 17/18] mtd: spear_smi: Convert to devm_platform_ioremap_resource()
2023-07-07 4:06 ` [PATCH 17/18] mtd: spear_smi: " Yangtao Li
@ 2023-07-12 14:13 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-12 14:13 UTC (permalink / raw)
To: Yangtao Li, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: linux-mtd, linux-kernel
On Fri, 2023-07-07 at 04:06:21 UTC, Yangtao Li wrote:
> Use devm_platform_ioremap_resource() to simplify code.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 16/18] mtd: st_spi_fsm: Convert to devm_platform_ioremap_resource()
2023-07-07 4:06 ` [PATCH 16/18] mtd: st_spi_fsm: " Yangtao Li
@ 2023-07-12 14:13 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-12 14:13 UTC (permalink / raw)
To: Yangtao Li, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: linux-mtd, linux-kernel
On Fri, 2023-07-07 at 04:06:20 UTC, Yangtao Li wrote:
> Use devm_platform_ioremap_resource() to simplify code.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 15/18] mtd: lpddr2_nvm: Convert to devm_platform_ioremap_resource()
2023-07-07 4:06 ` [PATCH 15/18] mtd: lpddr2_nvm: Convert to devm_platform_ioremap_resource() Yangtao Li
@ 2023-07-12 14:13 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-12 14:13 UTC (permalink / raw)
To: Yangtao Li, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: linux-mtd, linux-kernel
On Fri, 2023-07-07 at 04:06:19 UTC, Yangtao Li wrote:
> Use devm_platform_ioremap_resource() to simplify code.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 14/18] mtd: lantiq-flash: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 ` [PATCH 14/18] mtd: lantiq-flash: " Yangtao Li
@ 2023-07-12 14:13 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-12 14:13 UTC (permalink / raw)
To: Yangtao Li, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: linux-mtd, linux-kernel
On Fri, 2023-07-07 at 04:06:18 UTC, Yangtao Li wrote:
> 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.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 13/18] mtd: plat-ram: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 ` [PATCH 13/18] mtd: plat-ram: " Yangtao Li
@ 2023-07-12 14:13 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-12 14:13 UTC (permalink / raw)
To: Yangtao Li, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: linux-mtd, linux-kernel
On Fri, 2023-07-07 at 04:06:17 UTC, Yangtao Li wrote:
> 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.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 12/18] mtd: nand: omap: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 ` [PATCH 12/18] mtd: nand: omap: Use devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-13 7:57 ` Miquel Raynal
2023-07-14 15:27 ` Nathan Chancellor
0 siblings, 1 reply; 43+ messages in thread
From: Miquel Raynal @ 2023-07-13 7:57 UTC (permalink / raw)
To: Yangtao Li, Kyungmin Park, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: linux-mtd, linux-kernel
On Fri, 2023-07-07 at 04:06:16 UTC, Yangtao Li wrote:
> 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.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 11/18] mtd: nand: samsung: Convert to devm_platform_ioremap_resource() and devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 ` [PATCH 11/18] mtd: nand: samsung: Convert to devm_platform_ioremap_resource() and devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-13 7:57 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-13 7:57 UTC (permalink / raw)
To: Yangtao Li, Kyungmin Park, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: linux-mtd, linux-kernel
On Fri, 2023-07-07 at 04:06:15 UTC, Yangtao Li wrote:
> Use devm_platform_ioremap_resource() and
> devm_platform_get_and_ioremap_resource() to simplify code.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 10/18] mtd: rawnand: atmel: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 ` [PATCH 10/18] mtd: rawnand: atmel: Use devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-13 7:57 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-13 7:57 UTC (permalink / raw)
To: Yangtao Li, Tudor Ambarus, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea
Cc: linux-mtd, linux-arm-kernel, linux-kernel
On Fri, 2023-07-07 at 04:06:14 UTC, Yangtao Li wrote:
> 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.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 08/18] mtd: rawnand: fsl_upm: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 ` [PATCH 08/18] mtd: rawnand: fsl_upm: " Yangtao Li
@ 2023-07-13 7:58 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-13 7:58 UTC (permalink / raw)
To: Yangtao Li, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: linux-mtd, linux-kernel
On Fri, 2023-07-07 at 04:06:12 UTC, Yangtao Li wrote:
> 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.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 07/18] mtd: rawnand: lpc32xx_mlc: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 ` [PATCH 07/18] mtd: rawnand: lpc32xx_mlc: " Yangtao Li
@ 2023-07-13 7:58 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-13 7:58 UTC (permalink / raw)
To: Yangtao Li, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Vladimir Zapolskiy
Cc: linux-mtd, linux-arm-kernel, linux-kernel
On Fri, 2023-07-07 at 04:06:11 UTC, Yangtao Li wrote:
> 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.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 06/18] mtd: rawnand: stm32_fmc2: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 ` [PATCH 06/18] mtd: rawnand: stm32_fmc2: " Yangtao Li
@ 2023-07-13 7:58 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-13 7:58 UTC (permalink / raw)
To: Yangtao Li, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Maxime Coquelin, Alexandre Torgue
Cc: linux-mtd, linux-stm32, linux-arm-kernel, linux-kernel
On Fri, 2023-07-07 at 04:06:10 UTC, Yangtao Li wrote:
> 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.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 05/18] mtd: rawnand: omap2: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 ` [PATCH 05/18] mtd: rawnand: omap2: " Yangtao Li
@ 2023-07-13 7:58 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-13 7:58 UTC (permalink / raw)
To: Yangtao Li, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: linux-mtd, linux-kernel
On Fri, 2023-07-07 at 04:06:09 UTC, Yangtao Li wrote:
> 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.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 04/18] mtd: rawnand: sh_flctl: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 ` [PATCH 04/18] mtd: rawnand: sh_flctl: Use devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-13 7:58 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-13 7:58 UTC (permalink / raw)
To: Yangtao Li, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: linux-mtd, linux-kernel
On Fri, 2023-07-07 at 04:06:08 UTC, Yangtao Li wrote:
> 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.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 03/18] mtd: rawnand: mxc: Convert to devm_platform_ioremap_resource()
2023-07-07 4:06 ` [PATCH 03/18] mtd: rawnand: mxc: Convert to devm_platform_ioremap_resource() Yangtao Li
@ 2023-07-13 7:58 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-13 7:58 UTC (permalink / raw)
To: Yangtao Li, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: linux-mtd, linux-kernel
On Fri, 2023-07-07 at 04:06:07 UTC, Yangtao Li wrote:
> Use devm_platform_ioremap_resource() to simplify code.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 02/18] mtd: rawnand: lpc32xx_slc: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 ` [PATCH 02/18] mtd: rawnand: lpc32xx_slc: " Yangtao Li
@ 2023-07-13 7:58 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-13 7:58 UTC (permalink / raw)
To: Yangtao Li, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Vladimir Zapolskiy
Cc: linux-mtd, linux-arm-kernel, linux-kernel
On Fri, 2023-07-07 at 04:06:06 UTC, Yangtao Li wrote:
> 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.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource()
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
` (18 preceding siblings ...)
2023-07-12 11:54 ` Miquel Raynal
@ 2023-07-13 7:58 ` Miquel Raynal
19 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-13 7:58 UTC (permalink / raw)
To: Yangtao Li, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
Cc: linux-mtd, linux-arm-kernel, linux-sunxi, linux-kernel
On Fri, 2023-07-07 at 04:06:05 UTC, Yangtao Li wrote:
> 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.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 09/18] mtd: rawnand: davinci: Convert to devm_platform_ioremap_resource()
2023-07-12 12:09 ` Miquel Raynal
@ 2023-07-13 8:14 ` Yangtao Li
2023-07-13 8:26 ` Yangtao Li
1 sibling, 0 replies; 43+ messages in thread
From: Yangtao Li @ 2023-07-13 8:14 UTC (permalink / raw)
To: Miquel Raynal
Cc: Richard Weinberger, Vignesh Raghavendra, linux-mtd, linux-kernel
Hi Mique,
On 2023/7/12 20:09, Miquel Raynal wrote:
> Hi Yangtao,
>
> frank.li@vivo.com wrote on Fri, 7 Jul 2023 12:06:13 +0800:
>
>> Use devm_platform_ioremap_resource() to simplify code.
>>
>> Signed-off-by: Yangtao Li <frank.li@vivo.com>
>> ---
>> drivers/mtd/nand/raw/davinci_nand.c | 21 +++++++++------------
>> 1 file changed, 9 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
>> index 415d6aaa8255..2db1cd1d3d03 100644
>> --- a/drivers/mtd/nand/raw/davinci_nand.c
>> +++ b/drivers/mtd/nand/raw/davinci_nand.c
>> @@ -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);
> 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
>
> I will apply all other patches, please send a v2 only for this one
> once improved.
>
>> return -EADDRNOTAVAIL;
>> }
>>
>
> Thanks,
> Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 09/18] mtd: rawnand: davinci: Convert to devm_platform_ioremap_resource()
2023-07-12 12:09 ` Miquel Raynal
2023-07-13 8:14 ` Yangtao Li
@ 2023-07-13 8:26 ` Yangtao Li
1 sibling, 0 replies; 43+ messages in thread
From: Yangtao Li @ 2023-07-13 8:26 UTC (permalink / raw)
To: miquel.raynal; +Cc: frank.li, linux-kernel, linux-mtd, richard, vigneshr
> 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/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 12/18] mtd: nand: omap: Use devm_platform_get_and_ioremap_resource()
2023-07-13 7:57 ` Miquel Raynal
@ 2023-07-14 15:27 ` Nathan Chancellor
2023-07-15 16:06 ` Miquel Raynal
0 siblings, 1 reply; 43+ messages in thread
From: Nathan Chancellor @ 2023-07-14 15:27 UTC (permalink / raw)
To: Miquel Raynal
Cc: Yangtao Li, Kyungmin Park, Richard Weinberger,
Vignesh Raghavendra, linux-mtd, linux-kernel, llvm
On Thu, Jul 13, 2023 at 09:57:51AM +0200, Miquel Raynal wrote:
> On Fri, 2023-07-07 at 04:06:16 UTC, Yangtao Li wrote:
> > 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.
> >
> > Signed-off-by: Yangtao Li <frank.li@vivo.com>
>
> 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/20230713104422.29222-1-frank.li@vivo.com/
[2]: https://lore.kernel.org/64b137dc.170a0220.b8a13.feee@mx.google.com/
Cheers,
Nathan
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 12/18] mtd: nand: omap: Use devm_platform_get_and_ioremap_resource()
2023-07-14 15:27 ` Nathan Chancellor
@ 2023-07-15 16:06 ` Miquel Raynal
0 siblings, 0 replies; 43+ messages in thread
From: Miquel Raynal @ 2023-07-15 16:06 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Yangtao Li, Kyungmin Park, Richard Weinberger,
Vignesh Raghavendra, linux-mtd, linux-kernel, llvm
Hi Nathan,
nathan@kernel.org wrote on Fri, 14 Jul 2023 08:27:01 -0700:
> On Thu, Jul 13, 2023 at 09:57:51AM +0200, Miquel Raynal wrote:
> > On Fri, 2023-07-07 at 04:06:16 UTC, Yangtao Li wrote:
> > > 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.
> > >
> > > Signed-off-by: Yangtao Li <frank.li@vivo.com>
> >
> > 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.
>
> 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/20230713104422.29222-1-frank.li@vivo.com/
> [2]: https://lore.kernel.org/64b137dc.170a0220.b8a13.feee@mx.google.com/
>
> Cheers,
> Nathan
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 43+ messages in thread
end of thread, other threads:[~2023-07-15 16:07 UTC | newest]
Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-07 4:06 [PATCH 01/18] mtd: rawnand: sunxi: Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-07 4:06 ` [PATCH 02/18] mtd: rawnand: lpc32xx_slc: " Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 03/18] mtd: rawnand: mxc: Convert to devm_platform_ioremap_resource() Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 04/18] mtd: rawnand: sh_flctl: Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 05/18] mtd: rawnand: omap2: " Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 06/18] mtd: rawnand: stm32_fmc2: " Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 07/18] mtd: rawnand: lpc32xx_mlc: " Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 08/18] mtd: rawnand: fsl_upm: " Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 09/18] mtd: rawnand: davinci: Convert to devm_platform_ioremap_resource() Yangtao Li
2023-07-12 12:09 ` Miquel Raynal
2023-07-13 8:14 ` Yangtao Li
2023-07-13 8:26 ` Yangtao Li
2023-07-07 4:06 ` [PATCH 10/18] mtd: rawnand: atmel: Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-13 7:57 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 11/18] mtd: nand: samsung: Convert to devm_platform_ioremap_resource() and devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-13 7:57 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 12/18] mtd: nand: omap: Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-13 7:57 ` Miquel Raynal
2023-07-14 15:27 ` Nathan Chancellor
2023-07-15 16:06 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 13/18] mtd: plat-ram: " Yangtao Li
2023-07-12 14:13 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 14/18] mtd: lantiq-flash: " Yangtao Li
2023-07-12 14:13 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 15/18] mtd: lpddr2_nvm: Convert to devm_platform_ioremap_resource() Yangtao Li
2023-07-12 14:13 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 16/18] mtd: st_spi_fsm: " Yangtao Li
2023-07-12 14:13 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 17/18] mtd: spear_smi: " Yangtao Li
2023-07-12 14:13 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 18/18] mtd: physmap-core: Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-12 14:13 ` Miquel Raynal
2023-07-11 18:23 ` [PATCH 01/18] mtd: rawnand: sunxi: " Jernej Škrabec
2023-07-12 11:54 ` Miquel Raynal
2023-07-12 12:06 ` Miquel Raynal
2023-07-13 7:58 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).