Re: [PATCH 03/12] clocksource: Remove clocksource_max_deferment()

From: Ingo Molnar
Date: Sat Mar 07 2015 - 04:18:55 EST



* John Stultz <john.stultz@xxxxxxxxxx> wrote:

> clocksource_max_deferment() doesn't do anything useful
> anymore, so zap it.

Well, it does something useful, it encapsulates the max_deferment
property of the clocksource:

> -static u64 clocksource_max_deferment(struct clocksource *cs)
> -{
> - u64 max_nsecs;
> -
> - max_nsecs = clocks_calc_max_nsecs(cs->mult, cs->shift, cs->maxadj,
> - cs->mask);
> - return max_nsecs;
> -}

Which could be written in a shorter form, using:

static u64 clocksource_max_deferment(struct clocksource *cs)
{
return clocks_calc_max_nsecs(cs->mult, cs->shift, cs->maxadj, cs->mask);
}

Which all allows short forms of:

cs->max_idle_ns = clocksource_max_deferment(cs);

without writing out all the arguments.

Instead of that, you've introduced:

> + cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
> + cs->maxadj, cs->mask);

> + cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
> + cs->maxadj, cs->mask);

Which in the next patch gets even worse:


> cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
> + cs->maxadj, cs->mask,
> + &cs->max_cycles);

> /* calculate max idle time permitted for this clocksource */
> cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
> + cs->maxadj, cs->mask,
> + &cs->max_cycles);

While with the helper function it would still be the same sweet:

cs->max_idle_ns = clocksource_max_deferment(cs);

So I don't think this cleanup is an improvement ...

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/