From: Thomas Gleixner Date: Wed, 8 Apr 2026 11:54:24 +0000 (+0200) Subject: power: supply: charger-manager: Switch to alarm_start_timer() X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=9fa2e38ab749f3966d9141da3c2cb6ce3a9a8e35;p=thirdparty%2Fkernel%2Flinux.git power: supply: charger-manager: Switch to alarm_start_timer() The existing alarm_start() interface is replaced with the new alarm_start_timer() mechanism, which does not longer queue an already expired timer and returns the state. Adjust the code to utilize this. No functional change intended. Signed-off-by: Thomas Gleixner Acked-by: Sebastian Reichel Link: https://patch.msgid.link/20260408114952.536945376@kernel.org --- diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c index c49e0e4d02f77..1b0239c591144 100644 --- a/drivers/power/supply/charger-manager.c +++ b/drivers/power/supply/charger-manager.c @@ -881,26 +881,22 @@ static bool cm_setup_timer(void) mutex_unlock(&cm_list_mtx); if (timer_req && cm_timer) { - ktime_t now, add; - /* * Set alarm with the polling interval (wakeup_ms) * The alarm time should be NOW + CM_RTC_SMALL or later. */ - if (wakeup_ms == UINT_MAX || - wakeup_ms < CM_RTC_SMALL * MSEC_PER_SEC) + if (wakeup_ms == UINT_MAX || wakeup_ms < CM_RTC_SMALL * MSEC_PER_SEC) wakeup_ms = 2 * CM_RTC_SMALL * MSEC_PER_SEC; pr_info("Charger Manager wakeup timer: %u ms\n", wakeup_ms); - now = ktime_get_boottime(); - add = ktime_set(wakeup_ms / MSEC_PER_SEC, - (wakeup_ms % MSEC_PER_SEC) * NSEC_PER_MSEC); - alarm_start(cm_timer, ktime_add(now, add)); - cm_suspend_duration_ms = wakeup_ms; - return true; + /* + * The timer should always be queued as the timeout is at least + * two seconds out. Handle it correctly nevertheless. + */ + return alarm_start_timer(cm_timer, ktime_add_ms(0, wakeup_ms), true); } return false; }