Skip to contentSkip to conversation

thermal/hwmon: Use devm_platform_ioremap_resource()

PATCH In review Yang Li 3 participants 3 messages Mar 8, 2023

Subsystems (2)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 thermal/hwmon: Use devm_platform_ioremap_resource()

According to commit 7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()"), convert platform_get_resource(), devm_ioremap_resource() to a single call to Use devm_platform_ioremap_resource(), as this is exactly what this function does.

---
 drivers/thermal/rcar_thermal.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/thermal/rcar_thermal.c +1 -3
index b8571f7090aa..ee2dde1fbe2a 100644
@@ -435,9 +435,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;
Signature · 1 line
2.20.1.7.g153144c
Reviewed-by on v1 1/1
#1 lore raw

Hi Yang,

Quoted 5 lines · Yang Li

According to commit 7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()"), convert platform_get_resource(), devm_ioremap_resource() to a single call to Use devm_platform_ioremap_resource(), as this is exactly what this function does.

Thanks for your patch!

Quoted 1 line

drivers/thermal/rcar_thermal.c static int rcar_thermal_probe(struct platform_device *pdev) · line 441

Quoted 13 lines
drivers/thermal/rcar_thermal.c +1 -3
@@ -435,9 +435,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;

Note that there is a second opportunity for conversion in the same function, a few lines below.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#2 lore raw
Quoted 3 lines

Note that there is a second opportunity for conversion in the same function, a few lines below.

This should be fixed in a V2, then, not in an incremental patch, please.