[tip: timers/core] timers: Split out get next timer interrupt

From: tip-bot2 for Anna-Maria Behnsen
Date: Thu Feb 22 2024 - 12:15:00 EST


The following commit has been merged into the timers/core branch of tip:

Commit-ID: 39ed699fb660c65cef4759c041763c75e0948425
Gitweb: https://git.kernel.org/tip/39ed699fb660c65cef4759c041763c75e0948425
Author: Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx>
AuthorDate: Wed, 21 Feb 2024 10:05:30 +01:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
CommitterDate: Thu, 22 Feb 2024 17:52:30 +01:00

timers: Split out get next timer interrupt

Split out get_next_timer_interrupt() to be able to extend it and make it
reusable for other call sites.

No functional change.

Signed-off-by: Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Reviewed-by: Frederic Weisbecker <frederic@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20240221090548.36600-3-anna-maria@xxxxxxxxxxxxx

---
kernel/time/timer.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 316ded6..9f0cdba 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1956,15 +1956,7 @@ static u64 cmp_next_hrtimer_event(u64 basem, u64 expires)
return DIV_ROUND_UP_ULL(nextevt, TICK_NSEC) * TICK_NSEC;
}

-/**
- * get_next_timer_interrupt - return the time (clock mono) of the next timer
- * @basej: base time jiffies
- * @basem: base time clock monotonic
- *
- * Returns the tick aligned clock monotonic time of the next pending
- * timer or KTIME_MAX if no timer is pending.
- */
-u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
+static inline u64 __get_next_timer_interrupt(unsigned long basej, u64 basem)
{
struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]);
unsigned long nextevt = basej + NEXT_TIMER_MAX_DELTA;
@@ -2024,6 +2016,19 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
}

/**
+ * get_next_timer_interrupt() - return the time (clock mono) of the next timer
+ * @basej: base time jiffies
+ * @basem: base time clock monotonic
+ *
+ * Returns the tick aligned clock monotonic time of the next pending
+ * timer or KTIME_MAX if no timer is pending.
+ */
+u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
+{
+ return __get_next_timer_interrupt(basej, basem);
+}
+
+/**
* timer_clear_idle - Clear the idle state of the timer base
*
* Called with interrupts disabled