mirror of
https://github.com/torvalds/linux.git
synced 2025-04-12 06:49:52 +00:00
time: Switch to hrtimer_setup()
hrtimer_setup() takes the callback function pointer as argument and initializes the timer completely. Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism. Signed-off-by: Nam Cao <namcao@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/170bb691a0d59917c8268a98c80b607128fc9f7f.1738746821.git.namcao@linutronix.de
This commit is contained in:
parent
9eeb54b475
commit
f66b0acf39
@ -678,8 +678,7 @@ void ntp_notify_cmos_timer(bool offset_set)
|
||||
|
||||
static void __init ntp_init_cmos_sync(void)
|
||||
{
|
||||
hrtimer_init(&sync_hrtimer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
|
||||
sync_hrtimer.function = sync_timer_callback;
|
||||
hrtimer_setup(&sync_hrtimer, sync_timer_callback, CLOCK_REALTIME, HRTIMER_MODE_ABS);
|
||||
}
|
||||
#else /* CONFIG_GENERIC_CMOS_UPDATE) || defined(CONFIG_RTC_SYSTOHC) */
|
||||
static inline void __init ntp_init_cmos_sync(void) { }
|
||||
|
@ -381,7 +381,7 @@ static void posix_timer_unhash_and_free(struct k_itimer *tmr)
|
||||
|
||||
static int common_timer_create(struct k_itimer *new_timer)
|
||||
{
|
||||
hrtimer_init(&new_timer->it.real.timer, new_timer->it_clock, 0);
|
||||
hrtimer_setup(&new_timer->it.real.timer, posix_timer_fn, new_timer->it_clock, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -747,7 +747,7 @@ static void common_hrtimer_arm(struct k_itimer *timr, ktime_t expires,
|
||||
/*
|
||||
* Posix magic: Relative CLOCK_REALTIME timers are not affected by
|
||||
* clock modifications, so they become CLOCK_MONOTONIC based under the
|
||||
* hood. See hrtimer_init(). Update timr->kclock, so the generic
|
||||
* hood. See hrtimer_setup(). Update timr->kclock, so the generic
|
||||
* functions which use timr->kclock->clock_get_*() work.
|
||||
*
|
||||
* Note: it_clock stays unmodified, because the next timer_set() might
|
||||
@ -756,8 +756,7 @@ static void common_hrtimer_arm(struct k_itimer *timr, ktime_t expires,
|
||||
if (timr->it_clock == CLOCK_REALTIME)
|
||||
timr->kclock = absolute ? &clock_realtime : &clock_monotonic;
|
||||
|
||||
hrtimer_init(&timr->it.real.timer, timr->it_clock, mode);
|
||||
timr->it.real.timer.function = posix_timer_fn;
|
||||
hrtimer_setup(&timr->it.real.timer, posix_timer_fn, timr->it_clock, mode);
|
||||
|
||||
if (!absolute)
|
||||
expires = ktime_add_safe(expires, timer->base->get_time());
|
||||
|
@ -263,8 +263,7 @@ void __init generic_sched_clock_init(void)
|
||||
* Start the timer to keep sched_clock() properly updated and
|
||||
* sets the initial epoch.
|
||||
*/
|
||||
hrtimer_init(&sched_clock_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
|
||||
sched_clock_timer.function = sched_clock_poll;
|
||||
hrtimer_setup(&sched_clock_timer, sched_clock_poll, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
|
||||
hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL_HARD);
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,6 @@ static enum hrtimer_restart bc_handler(struct hrtimer *t)
|
||||
|
||||
void tick_setup_hrtimer_broadcast(void)
|
||||
{
|
||||
hrtimer_init(&bctimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD);
|
||||
bctimer.function = bc_handler;
|
||||
hrtimer_setup(&bctimer, bc_handler, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD);
|
||||
clockevents_register_device(&ce_broadcast_hrtimer);
|
||||
}
|
||||
|
@ -1573,12 +1573,10 @@ void tick_setup_sched_timer(bool hrtimer)
|
||||
struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched);
|
||||
|
||||
/* Emulate tick processing via per-CPU hrtimers: */
|
||||
hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD);
|
||||
hrtimer_setup(&ts->sched_timer, tick_nohz_handler, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD);
|
||||
|
||||
if (IS_ENABLED(CONFIG_HIGH_RES_TIMERS) && hrtimer) {
|
||||
if (IS_ENABLED(CONFIG_HIGH_RES_TIMERS) && hrtimer)
|
||||
tick_sched_flag_set(ts, TS_FLAG_HIGHRES);
|
||||
ts->sched_timer.function = tick_nohz_handler;
|
||||
}
|
||||
|
||||
/* Get the next period (per-CPU) */
|
||||
hrtimer_set_expires(&ts->sched_timer, tick_init_jiffy_update());
|
||||
|
Loading…
x
Reference in New Issue
Block a user