linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: rc: Use devm_platform_ioremap_resource() in tango_ir_probe()
@ 2019-09-18 10:37 Markus Elfring
  2019-09-18 11:00 ` Måns Rullgård
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2019-09-18 10:37 UTC (permalink / raw)
  To: linux-media, linux-arm-kernel, Allison Randal,
	Greg Kroah-Hartman, Mans Rullgard, Marc Gonzalez,
	Mauro Carvalho Chehab, Thomas Gleixner
  Cc: LKML, kernel-janitors, Bartosz Golaszewski, Himanshu Jha

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 18 Sep 2019 12:30:18 +0200

Simplify this function implementation by using a known wrapper function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/rc/tango-ir.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/media/rc/tango-ir.c b/drivers/media/rc/tango-ir.c
index 451ec4e9dcfa..b8eb5bc4d9be 100644
--- a/drivers/media/rc/tango-ir.c
+++ b/drivers/media/rc/tango-ir.c
@@ -157,20 +157,10 @@ static int tango_ir_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct rc_dev *rc;
 	struct tango_ir *ir;
-	struct resource *rc5_res;
-	struct resource *rc6_res;
 	u64 clkrate, clkdiv;
 	int irq, err;
 	u32 val;

-	rc5_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!rc5_res)
-		return -EINVAL;
-
-	rc6_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (!rc6_res)
-		return -EINVAL;
-
 	irq = platform_get_irq(pdev, 0);
 	if (irq <= 0)
 		return -EINVAL;
@@ -179,11 +169,11 @@ static int tango_ir_probe(struct platform_device *pdev)
 	if (!ir)
 		return -ENOMEM;

-	ir->rc5_base = devm_ioremap_resource(dev, rc5_res);
+	ir->rc5_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(ir->rc5_base))
 		return PTR_ERR(ir->rc5_base);

-	ir->rc6_base = devm_ioremap_resource(dev, rc6_res);
+	ir->rc6_base = devm_platform_ioremap_resource(pdev, 1);
 	if (IS_ERR(ir->rc6_base))
 		return PTR_ERR(ir->rc6_base);

--
2.23.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: rc: Use devm_platform_ioremap_resource() in tango_ir_probe()
  2019-09-18 10:37 [PATCH] media: rc: Use devm_platform_ioremap_resource() in tango_ir_probe() Markus Elfring
@ 2019-09-18 11:00 ` Måns Rullgård
  0 siblings, 0 replies; 2+ messages in thread
From: Måns Rullgård @ 2019-09-18 11:00 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-media, linux-arm-kernel, Allison Randal,
	Greg Kroah-Hartman, Marc Gonzalez, Mauro Carvalho Chehab,
	Thomas Gleixner, LKML, kernel-janitors, Bartosz Golaszewski,
	Himanshu Jha

Markus Elfring <Markus.Elfring@web.de> writes:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 18 Sep 2019 12:30:18 +0200
>
> Simplify this function implementation by using a known wrapper function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Mans Rullgard <mans@mansr.com>

> ---
>  drivers/media/rc/tango-ir.c | 14 ++------------
>  1 file changed, 2 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/media/rc/tango-ir.c b/drivers/media/rc/tango-ir.c
> index 451ec4e9dcfa..b8eb5bc4d9be 100644
> --- a/drivers/media/rc/tango-ir.c
> +++ b/drivers/media/rc/tango-ir.c
> @@ -157,20 +157,10 @@ static int tango_ir_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct rc_dev *rc;
>  	struct tango_ir *ir;
> -	struct resource *rc5_res;
> -	struct resource *rc6_res;
>  	u64 clkrate, clkdiv;
>  	int irq, err;
>  	u32 val;
>
> -	rc5_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!rc5_res)
> -		return -EINVAL;
> -
> -	rc6_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> -	if (!rc6_res)
> -		return -EINVAL;
> -
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq <= 0)
>  		return -EINVAL;
> @@ -179,11 +169,11 @@ static int tango_ir_probe(struct platform_device *pdev)
>  	if (!ir)
>  		return -ENOMEM;
>
> -	ir->rc5_base = devm_ioremap_resource(dev, rc5_res);
> +	ir->rc5_base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(ir->rc5_base))
>  		return PTR_ERR(ir->rc5_base);
>
> -	ir->rc6_base = devm_ioremap_resource(dev, rc6_res);
> +	ir->rc6_base = devm_platform_ioremap_resource(pdev, 1);
>  	if (IS_ERR(ir->rc6_base))
>  		return PTR_ERR(ir->rc6_base);
>
> --
> 2.23.0
>

-- 
Måns Rullgård

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-18 11:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-18 10:37 [PATCH] media: rc: Use devm_platform_ioremap_resource() in tango_ir_probe() Markus Elfring
2019-09-18 11:00 ` Måns Rullgård

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).