linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal: st: Use devm_platform_ioremap_resource() in st_mmap_regmap_init()
@ 2019-09-18 19:43 Markus Elfring
  2019-09-25 14:25 ` Amit Kucheria
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2019-09-18 19:43 UTC (permalink / raw)
  To: linux-pm, Allison Randal, Amit Kucheria, Daniel Lezcano,
	Eduardo Valentin, Greg Kroah-Hartman, Thomas Gleixner, Zhang Rui
  Cc: LKML, kernel-janitors, Bartosz Golaszewski, Himanshu Jha

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 18 Sep 2019 21:32:14 +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/thermal/st/st_thermal_memmap.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/thermal/st/st_thermal_memmap.c b/drivers/thermal/st/st_thermal_memmap.c
index a824b78dabf8..d8ff46abd8eb 100644
--- a/drivers/thermal/st/st_thermal_memmap.c
+++ b/drivers/thermal/st/st_thermal_memmap.c
@@ -121,15 +121,8 @@ static int st_mmap_regmap_init(struct st_thermal_sensor *sensor)
 {
 	struct device *dev = sensor->dev;
 	struct platform_device *pdev = to_platform_device(dev);
-	struct resource *res;

-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(dev, "no memory resources defined\n");
-		return -ENODEV;
-	}
-
-	sensor->mmio_base = devm_ioremap_resource(dev, res);
+	sensor->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(sensor->mmio_base)) {
 		dev_err(dev, "failed to remap IO\n");
 		return PTR_ERR(sensor->mmio_base);
--
2.23.0


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

* Re: [PATCH] thermal: st: Use devm_platform_ioremap_resource() in st_mmap_regmap_init()
  2019-09-18 19:43 [PATCH] thermal: st: Use devm_platform_ioremap_resource() in st_mmap_regmap_init() Markus Elfring
@ 2019-09-25 14:25 ` Amit Kucheria
  0 siblings, 0 replies; 2+ messages in thread
From: Amit Kucheria @ 2019-09-25 14:25 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Linux PM list, Allison Randal, Daniel Lezcano, Eduardo Valentin,
	Greg Kroah-Hartman, Thomas Gleixner, Zhang Rui, LKML,
	kernel-janitors, Bartosz Golaszewski, Himanshu Jha

On Wed, Sep 18, 2019 at 12:43 PM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 18 Sep 2019 21:32:14 +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>

Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>

> ---
>  drivers/thermal/st/st_thermal_memmap.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/thermal/st/st_thermal_memmap.c b/drivers/thermal/st/st_thermal_memmap.c
> index a824b78dabf8..d8ff46abd8eb 100644
> --- a/drivers/thermal/st/st_thermal_memmap.c
> +++ b/drivers/thermal/st/st_thermal_memmap.c
> @@ -121,15 +121,8 @@ static int st_mmap_regmap_init(struct st_thermal_sensor *sensor)
>  {
>         struct device *dev = sensor->dev;
>         struct platform_device *pdev = to_platform_device(dev);
> -       struct resource *res;
>
> -       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -       if (!res) {
> -               dev_err(dev, "no memory resources defined\n");
> -               return -ENODEV;
> -       }
> -
> -       sensor->mmio_base = devm_ioremap_resource(dev, res);
> +       sensor->mmio_base = devm_platform_ioremap_resource(pdev, 0);
>         if (IS_ERR(sensor->mmio_base)) {
>                 dev_err(dev, "failed to remap IO\n");
>                 return PTR_ERR(sensor->mmio_base);
> --
> 2.23.0
>

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

end of thread, other threads:[~2019-09-25 14:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-18 19:43 [PATCH] thermal: st: Use devm_platform_ioremap_resource() in st_mmap_regmap_init() Markus Elfring
2019-09-25 14:25 ` Amit Kucheria

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