Message ID | 27c67867-d39e-a5c1-12aa-a1e6ba6e7c32@web.de (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Daniel Lezcano |
Headers | show |
Series | thermal: st: Use devm_platform_ioremap_resource() in st_mmap_regmap_init() | expand |
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 >
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);