On Wed, Jun 10, 2020 at 2:43 PM Davide Caratti <[email protected]> wrote:
> +static void gate_setup_timer(struct tcf_gate *gact, u64 basetime,
> + enum tk_offsets tko, s32 clockid,
> + bool do_init)
> +{
> + bool timer_change = basetime != gact->param.tcfg_basetime ||
> + tko != gact->tk_offset ||
> + clockid != gact->param.tcfg_clockid;
> +
> + if (!do_init) {
> + if (timer_change) {
> + spin_unlock_bh(&gact->tcf_lock);
> + hrtimer_cancel(&gact->hitimer);
> + spin_lock_bh(&gact->tcf_lock);
> + goto init_hitimer;
> + }
> + return;
> + }
> +
> +init_hitimer:
> + 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;
> +}
This function would be more readable if you rewrite it like this:
if (!do_init && !timer_change)
return;
if (timer_change) {
...
}
...
The rest looks good to me.
Thanks.