Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/sched: Switch to use 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.

Patch was created by using Coccinelle.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/f1d4843589dd924743b35de1f0920c4a4c43be01.1738746872.git.namcao@linutronix.de

authored by

Nam Cao and committed by
Thomas Gleixner
efcb2d32 fe0b7765

+4 -8
+1 -2
net/sched/act_gate.c
··· 287 287 gact->param.tcfg_basetime = basetime; 288 288 gact->param.tcfg_clockid = clockid; 289 289 gact->tk_offset = tko; 290 - hrtimer_init(&gact->hitimer, clockid, HRTIMER_MODE_ABS_SOFT); 291 - gact->hitimer.function = gate_timer_func; 290 + hrtimer_setup(&gact->hitimer, gate_timer_func, clockid, HRTIMER_MODE_ABS_SOFT); 292 291 } 293 292 294 293 static int tcf_gate_init(struct net *net, struct nlattr *nla,
+1 -2
net/sched/sch_api.c
··· 619 619 void qdisc_watchdog_init_clockid(struct qdisc_watchdog *wd, struct Qdisc *qdisc, 620 620 clockid_t clockid) 621 621 { 622 - hrtimer_init(&wd->timer, clockid, HRTIMER_MODE_ABS_PINNED); 623 - wd->timer.function = qdisc_watchdog; 622 + hrtimer_setup(&wd->timer, qdisc_watchdog, clockid, HRTIMER_MODE_ABS_PINNED); 624 623 wd->qdisc = qdisc; 625 624 } 626 625 EXPORT_SYMBOL(qdisc_watchdog_init_clockid);
+2 -4
net/sched/sch_taprio.c
··· 1932 1932 if (!TXTIME_ASSIST_IS_ENABLED(q->flags) && 1933 1933 !FULL_OFFLOAD_IS_ENABLED(q->flags) && 1934 1934 !hrtimer_active(&q->advance_timer)) { 1935 - hrtimer_init(&q->advance_timer, q->clockid, HRTIMER_MODE_ABS); 1936 - q->advance_timer.function = advance_sched; 1935 + hrtimer_setup(&q->advance_timer, advance_sched, q->clockid, HRTIMER_MODE_ABS); 1937 1936 } 1938 1937 1939 1938 err = taprio_get_start_time(sch, new_admin, &start); ··· 2055 2056 2056 2057 spin_lock_init(&q->current_entry_lock); 2057 2058 2058 - hrtimer_init(&q->advance_timer, CLOCK_TAI, HRTIMER_MODE_ABS); 2059 - q->advance_timer.function = advance_sched; 2059 + hrtimer_setup(&q->advance_timer, advance_sched, CLOCK_TAI, HRTIMER_MODE_ABS); 2060 2060 2061 2061 q->root = sch; 2062 2062