From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Yangtao Li <frank.li@vivo.com>
Cc: Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 09/18] mtd: rawnand: davinci: Convert to devm_platform_ioremap_resource()
Date: Wed, 12 Jul 2023 14:09:53 +0200 [thread overview]
Message-ID: <20230712140953.30b5309c@xps-13> (raw)
In-Reply-To: <20230707040622.78174-9-frank.li@vivo.com>
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/
WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Yangtao Li <frank.li@vivo.com>
Cc: Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 09/18] mtd: rawnand: davinci: Convert to devm_platform_ioremap_resource()
Date: Wed, 12 Jul 2023 14:09:53 +0200 [thread overview]
Message-ID: <20230712140953.30b5309c@xps-13> (raw)
In-Reply-To: <20230707040622.78174-9-frank.li@vivo.com>
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
next prev parent reply other threads:[~2023-07-12 12:10 UTC|newest]
Thread overview: 99+ messages / expand[flat|nested] mbox.gz Atom feed top
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-07 4:06 ` 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-07 4:06 ` Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-13 7:58 ` Miquel Raynal
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-07 4:06 ` Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
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-07 4:06 ` Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-13 7:58 ` Miquel Raynal
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-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 06/18] mtd: rawnand: stm32_fmc2: " Yangtao Li
2023-07-07 4:06 ` Yangtao Li
2023-07-07 4:06 ` Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-13 7:58 ` Miquel Raynal
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 07/18] mtd: rawnand: lpc32xx_mlc: " Yangtao Li
2023-07-07 4:06 ` Yangtao Li
2023-07-07 4:06 ` Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
2023-07-13 7:58 ` Miquel Raynal
2023-07-13 7:58 ` Miquel Raynal
2023-07-07 4:06 ` [PATCH 08/18] mtd: rawnand: fsl_upm: " Yangtao Li
2023-07-07 4:06 ` Yangtao Li
2023-07-13 7:58 ` Miquel Raynal
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-07 4:06 ` Yangtao Li
2023-07-12 12:09 ` Miquel Raynal [this message]
2023-07-12 12:09 ` Miquel Raynal
2023-07-13 8:14 ` Yangtao Li
2023-07-13 8:14 ` Yangtao Li
2023-07-13 8:26 ` 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-07 4:06 ` Yangtao Li
2023-07-07 4:06 ` Yangtao Li
2023-07-13 7:57 ` Miquel Raynal
2023-07-13 7:57 ` Miquel Raynal
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-07 4:06 ` Yangtao Li
2023-07-13 7:57 ` Miquel Raynal
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-07 4:06 ` Yangtao Li
2023-07-13 7:57 ` Miquel Raynal
2023-07-13 7:57 ` Miquel Raynal
2023-07-14 15:27 ` Nathan Chancellor
2023-07-14 15:27 ` Nathan Chancellor
2023-07-15 16:06 ` Miquel Raynal
2023-07-15 16:06 ` Miquel Raynal
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-12 14:13 ` Miquel Raynal
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-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-07 4:06 ` Yangtao Li
2023-07-12 14:13 ` Miquel Raynal
2023-07-12 14:13 ` Miquel Raynal
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-12 14:13 ` Miquel Raynal
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-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-07 4:06 ` Yangtao Li
2023-07-12 14:13 ` Miquel Raynal
2023-07-12 14:13 ` Miquel Raynal
2023-07-11 18:23 ` [PATCH 01/18] mtd: rawnand: sunxi: " Jernej Škrabec
2023-07-11 18:23 ` Jernej Škrabec
2023-07-11 18:23 ` Jernej Škrabec
2023-07-12 11:54 ` Miquel Raynal
2023-07-12 11:54 ` Miquel Raynal
2023-07-12 11:54 ` Miquel Raynal
2023-07-12 12:06 ` Miquel Raynal
2023-07-12 12:06 ` Miquel Raynal
2023-07-12 12:06 ` Miquel Raynal
2023-07-13 7:58 ` Miquel Raynal
2023-07-13 7:58 ` Miquel Raynal
2023-07-13 7:58 ` Miquel Raynal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230712140953.30b5309c@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=frank.li@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.