Re: [PATCH 00/17] timers: Complete the timer_*() API renames

From: Ingo Molnar
Date: Mon Apr 14 2025 - 06:35:46 EST



* Ingo Molnar <mingo@xxxxxxxxxx> wrote:

> Complete the timer API namespace cleanup that begun with:
>
> 8fa7292fee5c treewide: Switch/rename to timer_delete[_sync]()
>
> The best way to view this series is to look at the right side
> column of this table of renames, in order of API appearance
> in <linux/timer.h>:
>
> add_timer_global() => timer_add_global()
> add_timer_local() => timer_add_local()
> from_timer() => timer_container_of()
> mod_timer_pending() => timer_mod_pending()
> timer_delete() ... [unchanged] ... timer_delete()
> timer_reduce() ... [unchanged] ... timer_reduce()
> timer_shutdown() ... [unchanged] ... timer_shutdown()
> timer_shutdown_sync() ... [unchanged] ... timer_shutdown_sync()
> try_to_del_timer_sync() => timer_delete_sync_try()
> add_timer() => timer_add()
> add_timer_on() => timer_add_on()
> mod_timer() => timer_mod()

BTW., my suggestion would be to maybe change this to timer_modify(),
because timer_mod() reads a bit weirdly.

This would be similar to how del_timer() was changed to timer_delete().

I didn't want to make bigger, discretionary changes in the first
iteration, but I can easily propagate any such suggestions into future
versions of this series.

If we do that, we'd also do timer_modify_pending().

> timer_delete_sync() ... [unchanged] ... timer_delete_sync()
> timer_setup_on_stack() ... [unchanged] ... timer_setup_on_stack()
> destroy_timer_on_stack() => timer_destroy_on_stack()
> timer_pending() ... [unchanged] ... timer_pending()
> timer_setup() ... [unchanged] ... timer_setup()
> init_timer_key() => timer_init_key()
> init_timer_on_stack_key() => timer_init_on_stack_key()

Maybe timer_init_key_on_stack()? Because the base name should be 'timer_init_key'.

That would similar to how we have:

__timer_init()
__timer_init_on_stack()

where _on_stack is a suffix.

>
> __init_timer() => __timer_init()
> __init_timer_on_stack() => __timer_init_on_stack()
>
> NEXT_TIMER_MAX_DELTA => TIMER_NEXT_MAX_DELTA
>
> init_timers() => timers_init()
> timers_dead_cpu() ... [unchanged] ... timers_dead_cpu()
> timers_prepare_cpu() ... [unchanged] ... timers_prepare_cpu()

Note that with this rename there's now a unified timers_*() namespace
for subsystem-wide functionality, such as boot-time setup or hotplug
callbacks.

Thanks,

Ingo