[PATCH] timers: Use the macro LVL_OFFS() to calculate the offset of each level

From: Dianlong Li
Date: Sun Aug 29 2021 - 03:00:05 EST


offset records the offset of the first bucket of each level,
this can be replaced by the macro LVL_OFFS()

Signed-off-by: Dianlong Li <dianlong_lee@xxxxxxx>
---
kernel/time/timer.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index e3d2c23c413d..3ee5322157a1 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1522,12 +1522,12 @@ static int next_pending_bucket(struct timer_base *base, unsigned offset,
static unsigned long __next_timer_interrupt(struct timer_base *base)
{
unsigned long clk, next, adj;
- unsigned lvl, offset = 0;
+ unsigned int lvl;

next = base->clk + NEXT_TIMER_MAX_DELTA;
clk = base->clk;
- for (lvl = 0; lvl < LVL_DEPTH; lvl++, offset += LVL_SIZE) {
- int pos = next_pending_bucket(base, offset, clk & LVL_MASK);
+ for (lvl = 0; lvl < LVL_DEPTH; lvl++) {
+ int pos = next_pending_bucket(base, LVL_OFFS(lvl), clk & LVL_MASK);
unsigned long lvl_clk = clk & LVL_CLK_MASK;

if (pos >= 0) {
--
2.17.1