diff mbox series

[2/2] memory: omap-gpmc: Make use of the devm_platform_ioremap_resource()

Message ID 20211221203916.18588-3-prabhakar.mahadev-lad.rj@bp.renesas.com
State New
Headers show
Series memory: omap-gpmc: Use platform_get_irq() to get the interrupt | expand

Commit Message

Prabhakar Mahadev Lad Dec. 21, 2021, 8:39 p.m. UTC
Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/memory/omap-gpmc.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Roger Quadros Dec. 22, 2021, 10:30 a.m. UTC | #1
Hi Lad,

On 21/12/2021 22:39, Lad Prabhakar wrote:
> Use the devm_platform_ioremap_resource() helper instead of
> calling platform_get_resource() and devm_ioremap_resource()
> separately.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
>  drivers/memory/omap-gpmc.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
> index 56f401ba53a5..582fe102f923 100644
> --- a/drivers/memory/omap-gpmc.c
> +++ b/drivers/memory/omap-gpmc.c
> @@ -2492,7 +2492,6 @@ static int gpmc_probe(struct platform_device *pdev)
>  {
>  	int rc;
>  	u32 l;
> -	struct resource *res;
>  	struct gpmc_device *gpmc;
>  
>  	gpmc = devm_kzalloc(&pdev->dev, sizeof(*gpmc), GFP_KERNEL);
> @@ -2502,11 +2501,7 @@ static int gpmc_probe(struct platform_device *pdev)
>  	gpmc->dev = &pdev->dev;
>  	platform_set_drvdata(pdev, gpmc);
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res)
> -		return -ENOENT;
> -
> -	gpmc_base = devm_ioremap_resource(&pdev->dev, res);
> +	gpmc_base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(gpmc_base))
>  		return PTR_ERR(gpmc_base);
>  
> 

Thanks for the patch but this is already being taken care of by this patch
https://lore.kernel.org/lkml/20211221131757.2030-4-rogerq@kernel.org/T/#m9516df757d98049d769601ee4601005f74f3cec7

--
cheers,
-roger
Prabhakar Dec. 22, 2021, 10:43 a.m. UTC | #2
Hi Roger,

On Wed, Dec 22, 2021 at 10:30 AM Roger Quadros <rogerq@kernel.org> wrote:
>
> Hi Lad,
>
> On 21/12/2021 22:39, Lad Prabhakar wrote:
> > Use the devm_platform_ioremap_resource() helper instead of
> > calling platform_get_resource() and devm_ioremap_resource()
> > separately.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > ---
> >  drivers/memory/omap-gpmc.c | 7 +------
> >  1 file changed, 1 insertion(+), 6 deletions(-)
> >
> > diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
> > index 56f401ba53a5..582fe102f923 100644
> > --- a/drivers/memory/omap-gpmc.c
> > +++ b/drivers/memory/omap-gpmc.c
> > @@ -2492,7 +2492,6 @@ static int gpmc_probe(struct platform_device *pdev)
> >  {
> >       int rc;
> >       u32 l;
> > -     struct resource *res;
> >       struct gpmc_device *gpmc;
> >
> >       gpmc = devm_kzalloc(&pdev->dev, sizeof(*gpmc), GFP_KERNEL);
> > @@ -2502,11 +2501,7 @@ static int gpmc_probe(struct platform_device *pdev)
> >       gpmc->dev = &pdev->dev;
> >       platform_set_drvdata(pdev, gpmc);
> >
> > -     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > -     if (!res)
> > -             return -ENOENT;
> > -
> > -     gpmc_base = devm_ioremap_resource(&pdev->dev, res);
> > +     gpmc_base = devm_platform_ioremap_resource(pdev, 0);
> >       if (IS_ERR(gpmc_base))
> >               return PTR_ERR(gpmc_base);
> >
> >
>
> Thanks for the patch but this is already being taken care of by this patch
> https://lore.kernel.org/lkml/20211221131757.2030-4-rogerq@kernel.org/T/#m9516df757d98049d769601ee4601005f74f3cec7
>
Thanks for the pointer, this patch can be dropped.

Cheers,
Prabhakar
diff mbox series

Patch

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 56f401ba53a5..582fe102f923 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -2492,7 +2492,6 @@  static int gpmc_probe(struct platform_device *pdev)
 {
 	int rc;
 	u32 l;
-	struct resource *res;
 	struct gpmc_device *gpmc;
 
 	gpmc = devm_kzalloc(&pdev->dev, sizeof(*gpmc), GFP_KERNEL);
@@ -2502,11 +2501,7 @@  static int gpmc_probe(struct platform_device *pdev)
 	gpmc->dev = &pdev->dev;
 	platform_set_drvdata(pdev, gpmc);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -ENOENT;
-
-	gpmc_base = devm_ioremap_resource(&pdev->dev, res);
+	gpmc_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(gpmc_base))
 		return PTR_ERR(gpmc_base);