]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/x86: hp-wmi: use mod_delayed_work to reset keep-alive timer
authorEmre Cecanpunar <emreleno@gmail.com>
Tue, 7 Apr 2026 14:25:12 +0000 (17:25 +0300)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thu, 9 Apr 2026 11:46:32 +0000 (14:46 +0300)
Currently, schedule_delayed_work() is used to queue the 90s keep-alive
timer. If a user manually changes the fan speed at T=85s,
schedule_delayed_work() leaves the existing timer in place as it is a
no-op if the work is already pending. This results in the keep-alive
timer firing unnecessarily at T=90s, just 5 seconds after the user
action.

Replace schedule_delayed_work() with mod_delayed_work() to reset the
90s timer whenever fan settings are applied. This guarantees a full 90s
delay after every user interaction, preventing redundant keep-alive
executions and improving efficiency.

Fixes: c203c59fb5de ("platform/x86: hp-wmi: implement fan keep-alive")
Signed-off-by: Emre Cecanpunar <emreleno@gmail.com>
Link: https://patch.msgid.link/20260407142515.20683-4-emreleno@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/hp/hp-wmi.c

index 79d6bc3cd223ad3abd0a7348825e9bdce36538e7..2932cab9aa78321d4a22775ac00e3869b6dc1e99 100644 (file)
@@ -2361,8 +2361,8 @@ static int hp_wmi_apply_fan_settings(struct hp_wmi_hwmon_priv *priv)
                ret = hp_wmi_fan_speed_max_set(1);
                if (ret < 0)
                        return ret;
-               schedule_delayed_work(&priv->keep_alive_dwork,
-                                     secs_to_jiffies(KEEP_ALIVE_DELAY_SECS));
+               mod_delayed_work(system_wq, &priv->keep_alive_dwork,
+                                secs_to_jiffies(KEEP_ALIVE_DELAY_SECS));
                return 0;
        case PWM_MODE_MANUAL:
                if (!is_victus_s_thermal_profile())
@@ -2370,8 +2370,8 @@ static int hp_wmi_apply_fan_settings(struct hp_wmi_hwmon_priv *priv)
                ret = hp_wmi_fan_speed_set(priv, pwm_to_rpm(priv->pwm, priv));
                if (ret < 0)
                        return ret;
-               schedule_delayed_work(&priv->keep_alive_dwork,
-                                     secs_to_jiffies(KEEP_ALIVE_DELAY_SECS));
+               mod_delayed_work(system_wq, &priv->keep_alive_dwork,
+                                secs_to_jiffies(KEEP_ALIVE_DELAY_SECS));
                return 0;
        case PWM_MODE_AUTO:
                if (is_victus_s_thermal_profile()) {