Re: [patch V2 09/11] power: supply: charger-manager: Switch to alarm_start_timer()
From: Sebastian Reichel
Date: Thu Apr 09 2026 - 15:22:29 EST
Hi,
On Wed, Apr 08, 2026 at 01:54:24PM +0200, Thomas Gleixner wrote:
> 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>
> Cc: Sebastian Reichel <sre@xxxxxxxxxx>
> Cc: linux-pm@xxxxxxxxxxxxxxx
> ---
> V2: Rename to alarm_start_timer()
> ---
Acked-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx>
Greetings,
-- Sebastian
> drivers/power/supply/charger-manager.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
> --- a/drivers/power/supply/charger-manager.c
> +++ b/drivers/power/supply/charger-manager.c
> @@ -881,7 +881,7 @@ static bool cm_setup_timer(void)
> mutex_unlock(&cm_list_mtx);
>
> if (timer_req && cm_timer) {
> - ktime_t now, add;
> + ktime_t exp;
>
> /*
> * Set alarm with the polling interval (wakeup_ms)
> @@ -893,14 +893,16 @@ static bool cm_setup_timer(void)
>
> pr_info("Charger Manager wakeup timer: %u ms\n", wakeup_ms);
>
> - now = ktime_get_boottime();
> - add = ktime_set(wakeup_ms / MSEC_PER_SEC,
> + exp = 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, exp, true);
> }
> return false;
> }
>
Attachment:
signature.asc
Description: PGP signature