[v8,07/25] timers: Use already existing function for forwarding timer base

Message ID 20231004123454.15691-8-anna-maria@linutronix.de
State New
Headers
Series timer: Move from a push remote at enqueue to a pull at expiry model |

Commit Message

Anna-Maria Behnsen Oct. 4, 2023, 12:34 p.m. UTC
  There is an already existing function for forwarding the timer
base. Forwarding the timer base is implemented directly in
get_next_timer_interrupt() as well.

To avoid code duplication, replace implementation for forwarding timer base
with the direct call to the already existing function.

Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
---
 kernel/time/timer.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
  

Comments

Frederic Weisbecker Oct. 6, 2023, 11:17 a.m. UTC | #1
On Wed, Oct 04, 2023 at 02:34:36PM +0200, Anna-Maria Behnsen wrote:
> There is an already existing function for forwarding the timer
> base. Forwarding the timer base is implemented directly in
> get_next_timer_interrupt() as well.
> 
> To avoid code duplication, replace implementation for forwarding timer base
> with the direct call to the already existing function.
> 
> Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>

Good catch!

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
  

Patch

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 2f6afd1da891..dc58c479d35a 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1939,15 +1939,9 @@  u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
 
 	/*
 	 * We have a fresh next event. Check whether we can forward the
-	 * base. We can only do that when @basej is past base->clk
-	 * otherwise we might rewind base->clk.
+	 * base.
 	 */
-	if (time_after(basej, base->clk)) {
-		if (time_after(nextevt, basej))
-			base->clk = basej;
-		else if (time_after(nextevt, base->clk))
-			base->clk = nextevt;
-	}
+	__forward_timer_base(base, basej);
 
 	if (time_before_eq(nextevt, basej)) {
 		expires = basem;