[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20210605083212.2069195-1-yangyingliang@huawei.com>
Date: Sat, 5 Jun 2021 16:32:12 +0800
From: Yang Yingliang <yangyingliang@...wei.com>
To: <linux-kernel@...r.kernel.org>, <linux-pm@...r.kernel.org>
CC: <rui.zhang@...el.com>, <daniel.lezcano@...aro.org>,
<amitk@...nel.org>
Subject: [PATCH -next] thermal: st: Use devm_platform_get_and_ioremap_resource()
Use devm_platform_get_and_ioremap_resource() to simplify
code and remove error message which within
devm_platform_get_and_ioremap_resource() already.
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
drivers/thermal/st/st_thermal_memmap.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/thermal/st/st_thermal_memmap.c b/drivers/thermal/st/st_thermal_memmap.c
index a0114452d11f..35e904da7582 100644
--- a/drivers/thermal/st/st_thermal_memmap.c
+++ b/drivers/thermal/st/st_thermal_memmap.c
@@ -121,17 +121,9 @@ static int st_mmap_regmap_init(struct st_thermal_sensor *sensor)
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);
- if (IS_ERR(sensor->mmio_base)) {
- dev_err(dev, "failed to remap IO\n");
+ sensor->mmio_base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
+ if (IS_ERR(sensor->mmio_base))
return PTR_ERR(sensor->mmio_base);
- }
sensor->regmap = devm_regmap_init_mmio(dev, sensor->mmio_base,
&st_416mpe_regmap_config);
--
2.25.1
Powered by blists - more mailing lists