]> git.baikalelectronics.ru Git - kernel.git/commit
timers: Simplify calc_index()
authorThomas Gleixner <tglx@linutronix.de>
Mon, 4 Apr 2022 14:47:55 +0000 (16:47 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 9 Apr 2022 20:19:39 +0000 (22:19 +0200)
commit7a2cea1b2e0549c61869f88611c84db5638efa8b
treebce89de4ce23346ff21fa3f837dcd2cc29d6763b
parentd8769abab841060956bfc57025abb71455ef651f
timers: Simplify calc_index()

The level granularity round up of calc_index() does:

   (x + (1 << n)) >> n

which is obviously equivalent to

   (x >> n) + 1

but compilers can't figure that out despite the fact that the input range
is known to not cause an overflow. It's neither intuitive to read.

Just write out the obvious.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/87h778j46c.ffs@tglx
kernel/time/timer.c