diff mbox series

[thermal:,thermal/next] thermal/drivers/st: Use devm_platform_get_and_ioremap_resource()

Message ID 162426880735.395.10957573054359964451.tip-bot2@tip-bot2
State New
Headers show
Series [thermal:,thermal/next] thermal/drivers/st: Use devm_platform_get_and_ioremap_resource() | expand

Commit Message

thermal-bot for Julien Panis June 21, 2021, 9:46 a.m. UTC
The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     d7539260cd9ad9c18eaf2a1ff71401abdbdfb5cb
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//d7539260cd9ad9c18eaf2a1ff71401abdbdfb5cb
Author:        Yang Yingliang <yangyingliang@huawei.com>
AuthorDate:    Sat, 05 Jun 2021 20:02:05 +08:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Mon, 14 Jun 2021 19:01:15 +02:00

thermal/drivers/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@huawei.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210605120205.2459578-1-yangyingliang@huawei.com
---
 drivers/thermal/st/st_thermal_memmap.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/drivers/thermal/st/st_thermal_memmap.c b/drivers/thermal/st/st_thermal_memmap.c
index a011445..d68596c 100644
--- a/drivers/thermal/st/st_thermal_memmap.c
+++ b/drivers/thermal/st/st_thermal_memmap.c
@@ -119,19 +119,10 @@  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);
-	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, NULL);
+	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);