]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net/sched: Switch to use hrtimer_setup()
authorNam Cao <namcao@linutronix.de>
Wed, 5 Feb 2025 10:43:22 +0000 (11:43 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 18 Feb 2025 09:35:44 +0000 (10:35 +0100)
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
net/sched/act_gate.c
net/sched/sch_api.c
net/sched/sch_taprio.c

index 91c0ec729823be812561063b0828249fae94689e..c1f75f2727576f1b5b896728f73d3194123c840f 100644 (file)
@@ -287,8 +287,7 @@ static void gate_setup_timer(struct tcf_gate *gact, u64 basetime,
        gact->param.tcfg_basetime = basetime;
        gact->param.tcfg_clockid = clockid;
        gact->tk_offset = tko;
-       hrtimer_init(&gact->hitimer, clockid, HRTIMER_MODE_ABS_SOFT);
-       gact->hitimer.function = gate_timer_func;
+       hrtimer_setup(&gact->hitimer, gate_timer_func, clockid, HRTIMER_MODE_ABS_SOFT);
 }
 
 static int tcf_gate_init(struct net *net, struct nlattr *nla,
index e3e91cf867eb99e41bac93ec30f6af3de777ce56..6d85b342a85764d36bc9da5b44f9547b6c6c2e9d 100644 (file)
@@ -619,8 +619,7 @@ static enum hrtimer_restart qdisc_watchdog(struct hrtimer *timer)
 void qdisc_watchdog_init_clockid(struct qdisc_watchdog *wd, struct Qdisc *qdisc,
                                 clockid_t clockid)
 {
-       hrtimer_init(&wd->timer, clockid, HRTIMER_MODE_ABS_PINNED);
-       wd->timer.function = qdisc_watchdog;
+       hrtimer_setup(&wd->timer, qdisc_watchdog, clockid, HRTIMER_MODE_ABS_PINNED);
        wd->qdisc = qdisc;
 }
 EXPORT_SYMBOL(qdisc_watchdog_init_clockid);
index a68e17891b0b51d01eca9b389db72e39cc0c34d6..14021b8123290655bdc388976ab45135a2da00f0 100644 (file)
@@ -1932,8 +1932,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
        if (!TXTIME_ASSIST_IS_ENABLED(q->flags) &&
            !FULL_OFFLOAD_IS_ENABLED(q->flags) &&
            !hrtimer_active(&q->advance_timer)) {
-               hrtimer_init(&q->advance_timer, q->clockid, HRTIMER_MODE_ABS);
-               q->advance_timer.function = advance_sched;
+               hrtimer_setup(&q->advance_timer, advance_sched, q->clockid, HRTIMER_MODE_ABS);
        }
 
        err = taprio_get_start_time(sch, new_admin, &start);
@@ -2056,8 +2055,7 @@ static int taprio_init(struct Qdisc *sch, struct nlattr *opt,
 
        spin_lock_init(&q->current_entry_lock);
 
-       hrtimer_init(&q->advance_timer, CLOCK_TAI, HRTIMER_MODE_ABS);
-       q->advance_timer.function = advance_sched;
+       hrtimer_setup(&q->advance_timer, advance_sched, CLOCK_TAI, HRTIMER_MODE_ABS);
 
        q->root = sch;