[PATCH v8 15/25] timer: Split next timer interrupt logic

From: Anna-Maria Behnsen
Date: Wed Oct 04 2023 - 08:36:08 EST


Logic for getting next timer interrupt (no matter of recalculated or
already stored in base->next_expiry) is split into a separate function
"next_timer_interrupt()" to make it available for new call sites.

No functional change.

Signed-off-by: Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx>
Reviewed-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Reviewed-by: Frederic Weisbecker <frederic@xxxxxxxxxx>
---
kernel/time/timer.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 1aafa0edc74c..7468a805d302 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1951,14 +1951,20 @@ static u64 cmp_next_hrtimer_event(u64 basem, u64 expires)
return DIV_ROUND_UP_ULL(nextevt, TICK_NSEC) * TICK_NSEC;
}

+static unsigned long next_timer_interrupt(struct timer_base *base)
+{
+ if (base->next_expiry_recalc)
+ next_expiry_recalc(base);
+
+ return base->next_expiry;
+}
+
static inline unsigned long __get_next_timer_interrupt(unsigned long basej,
struct timer_base *base)
{
unsigned long nextevt;

- if (base->next_expiry_recalc)
- next_expiry_recalc(base);
- nextevt = base->next_expiry;
+ nextevt = next_timer_interrupt(base);

if (base->timers_pending) {
/* If we missed a tick already, force 0 delta */
--
2.39.2