[PATCH 5/6] thermal/drivers/rcar: Convert to devm_platform_ioremap_resource()

From: Yangtao Li
Date: Mon Jun 26 2023 - 08:44:32 EST


Use devm_platform_ioremap_resource() to simplify code.

Signed-off-by: Yangtao Li <frank.li@xxxxxxxx>
---
drivers/thermal/rcar_thermal.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index b8571f7090aa..04a52d82022c 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -397,7 +397,6 @@ static int rcar_thermal_probe(struct platform_device *pdev)
struct rcar_thermal_common *common;
struct rcar_thermal_priv *priv;
struct device *dev = &pdev->dev;
- struct resource *res;
const struct rcar_thermal_chip *chip = of_device_get_match_data(dev);
int mres = 0;
int i;
@@ -435,9 +434,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
* Then, driver uses common registers
* rcar_has_irq_support() will be enabled
*/
- res = platform_get_resource(pdev, IORESOURCE_MEM,
- mres++);
- common->base = devm_ioremap_resource(dev, res);
+ common->base = devm_platform_ioremap_resource(pdev, mres++);
if (IS_ERR(common->base)) {
ret = PTR_ERR(common->base);
goto error_unregister;
@@ -459,17 +456,13 @@ static int rcar_thermal_probe(struct platform_device *pdev)
}

for (i = 0;; i++) {
- res = platform_get_resource(pdev, IORESOURCE_MEM, mres++);
- if (!res)
- break;
-
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv) {
ret = -ENOMEM;
goto error_unregister;
}

- priv->base = devm_ioremap_resource(dev, res);
+ priv->base = devm_platform_ioremap_resource(pdev, mres++);
if (IS_ERR(priv->base)) {
ret = PTR_ERR(priv->base);
goto error_unregister;
--
2.39.0