[PATCH 2/2] hwmon: pwm-fan: use managed timer shutdown
From: Kirtikumar Anandrao Ramchandani
Date: Wed Nov 04 2026 - 19:05:09 EST
Replace the private devres timer cleanup action with
devm_timer_autoshutdown(). Keep initialization and action registration at
their existing positions, preserving the cleanup order. The system
shutdown path continues to call timer_shutdown_sync() directly.
Signed-off-by: Kirtikumar Anandrao Ramchandani <kirtiar15502@xxxxxxxxx>
---
drivers/hwmon/pwm-fan.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index 9cabbe9f8..6b02c2687 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -8,6 +8,7 @@
*/
#include <linux/delay.h>
+#include <linux/devm-helpers.h>
#include <linux/hwmon.h>
#include <linux/interrupt.h>
#include <linux/module.h>
@@ -493,13 +494,6 @@ static void pwm_fan_cleanup(void *__ctx)
}
}
-static void pwm_fan_timer_cleanup(void *__ctx)
-{
- struct pwm_fan_ctx *ctx = __ctx;
-
- timer_shutdown_sync(&ctx->rpm_timer);
-}
-
static int pwm_fan_probe(struct platform_device *pdev)
{
struct thermal_cooling_device *cdev;
@@ -650,7 +644,7 @@ static int pwm_fan_probe(struct platform_device *pdev)
}
if (ctx->tach_count > 0) {
- ret = devm_add_action_or_reset(dev, pwm_fan_timer_cleanup, ctx);
+ ret = devm_timer_autoshutdown(dev, &ctx->rpm_timer);
if (ret)
return ret;
@@ -710,7 +704,7 @@ static void pwm_fan_shutdown(struct platform_device *pdev)
{
struct pwm_fan_ctx *ctx = platform_get_drvdata(pdev);
- pwm_fan_timer_cleanup(ctx);
+ timer_shutdown_sync(&ctx->rpm_timer);
pwm_fan_cleanup(ctx);
}