[tip: timers/core] power: supply: charger-manager: Switch to alarm_start_timer()

From: tip-bot2 for Thomas Gleixner

Date: Fri May 01 2026 - 15:48:30 EST


The following commit has been merged into the timers/core branch of tip:

Commit-ID: 9fa2e38ab749f3966d9141da3c2cb6ce3a9a8e35
Gitweb: https://git.kernel.org/tip/9fa2e38ab749f3966d9141da3c2cb6ce3a9a8e35
Author: Thomas Gleixner <tglx@xxxxxxxxxx>
AuthorDate: Wed, 08 Apr 2026 13:54:24 +02:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Fri, 01 May 2026 21:36:13 +02:00

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 <tglx@xxxxxxxxxx>
Acked-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx>
Link: https://patch.msgid.link/20260408114952.536945376@xxxxxxxxxx
---
drivers/power/supply/charger-manager.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c
index c49e0e4..1b0239c 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;
}