diff mbox series

mtd: rawnand: atmel: Make use of the helper function devm_platform_ioremap_resource()

Message ID 20210901074031.8883-1-caihuoqing@baidu.com (mailing list archive)
State New, archived
Headers show
Series mtd: rawnand: atmel: Make use of the helper function devm_platform_ioremap_resource() | expand

Commit Message

Cai,Huoqing Sept. 1, 2021, 7:40 a.m. UTC
Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/mtd/nand/raw/atmel/pmecc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Nicolas Ferre Sept. 1, 2021, 9:51 a.m. UTC | #1
On 01/09/2021 at 09:40, Cai Huoqing wrote:
> Use the devm_platform_ioremap_resource() helper instead of
> calling platform_get_resource() and devm_ioremap_resource()
> separately
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>

Reviewed-by: Nicolas Ferre <nicolas.ferre@microchip.com>

> ---
>   drivers/mtd/nand/raw/atmel/pmecc.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/atmel/pmecc.c b/drivers/mtd/nand/raw/atmel/pmecc.c
> index cbb023bf00f7..498e41ccabbd 100644
> --- a/drivers/mtd/nand/raw/atmel/pmecc.c
> +++ b/drivers/mtd/nand/raw/atmel/pmecc.c
> @@ -834,7 +834,6 @@ static struct atmel_pmecc *atmel_pmecc_create(struct platform_device *pdev,
>   {
>          struct device *dev = &pdev->dev;
>          struct atmel_pmecc *pmecc;
> -       struct resource *res;
> 
>          pmecc = devm_kzalloc(dev, sizeof(*pmecc), GFP_KERNEL);
>          if (!pmecc)
> @@ -844,13 +843,11 @@ static struct atmel_pmecc *atmel_pmecc_create(struct platform_device *pdev,
>          pmecc->dev = dev;
>          mutex_init(&pmecc->lock);
> 
> -       res = platform_get_resource(pdev, IORESOURCE_MEM, pmecc_res_idx);
> -       pmecc->regs.base = devm_ioremap_resource(dev, res);
> +       pmecc->regs.base = devm_platform_ioremap_resource(pdev, pmecc_res_idx);
>          if (IS_ERR(pmecc->regs.base))
>                  return ERR_CAST(pmecc->regs.base);
> 
> -       res = platform_get_resource(pdev, IORESOURCE_MEM, errloc_res_idx);
> -       pmecc->regs.errloc = devm_ioremap_resource(dev, res);
> +       pmecc->regs.errloc = devm_platform_ioremap_resource(pdev, errloc_res_idx);
>          if (IS_ERR(pmecc->regs.errloc))
>                  return ERR_CAST(pmecc->regs.errloc);
> 
> --
> 2.25.1
>
Miquel Raynal Sept. 14, 2021, 5:40 p.m. UTC | #2
On Wed, 2021-09-01 at 07:40:30 UTC, Cai Huoqing wrote:
> Use the devm_platform_ioremap_resource() helper instead of
> calling platform_get_resource() and devm_ioremap_resource()
> separately
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> Reviewed-by: Nicolas Ferre <nicolas.ferre@microchip.com>

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

Miquel
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/atmel/pmecc.c b/drivers/mtd/nand/raw/atmel/pmecc.c
index cbb023bf00f7..498e41ccabbd 100644
--- a/drivers/mtd/nand/raw/atmel/pmecc.c
+++ b/drivers/mtd/nand/raw/atmel/pmecc.c
@@ -834,7 +834,6 @@  static struct atmel_pmecc *atmel_pmecc_create(struct platform_device *pdev,
 {
 	struct device *dev = &pdev->dev;
 	struct atmel_pmecc *pmecc;
-	struct resource *res;
 
 	pmecc = devm_kzalloc(dev, sizeof(*pmecc), GFP_KERNEL);
 	if (!pmecc)
@@ -844,13 +843,11 @@  static struct atmel_pmecc *atmel_pmecc_create(struct platform_device *pdev,
 	pmecc->dev = dev;
 	mutex_init(&pmecc->lock);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, pmecc_res_idx);
-	pmecc->regs.base = devm_ioremap_resource(dev, res);
+	pmecc->regs.base = devm_platform_ioremap_resource(pdev, pmecc_res_idx);
 	if (IS_ERR(pmecc->regs.base))
 		return ERR_CAST(pmecc->regs.base);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, errloc_res_idx);
-	pmecc->regs.errloc = devm_ioremap_resource(dev, res);
+	pmecc->regs.errloc = devm_platform_ioremap_resource(pdev, errloc_res_idx);
 	if (IS_ERR(pmecc->regs.errloc))
 		return ERR_CAST(pmecc->regs.errloc);