timekeeping: Tidy timekeeping_cycles_to_ns() slightly
authorAdrian Hunter <adrian.hunter@intel.com>
Mon, 25 Mar 2024 06:40:15 +0000 (08:40 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 8 Apr 2024 13:03:07 +0000 (15:03 +0200)
Put together declaration and initialization of the local variable 'delta'.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20240325064023.2997-12-adrian.hunter@intel.com
kernel/time/timekeeping.c

index 63061332a75c3eece8df9c751a491280be278f0f..c698219b152d858a565c9e3f3217ebdb821b0c49 100644 (file)
@@ -383,10 +383,9 @@ static inline u64 timekeeping_delta_to_ns(const struct tk_read_base *tkr, u64 de
 
 static inline u64 timekeeping_cycles_to_ns(const struct tk_read_base *tkr, u64 cycles)
 {
-       u64 delta;
+       /* Calculate the delta since the last update_wall_time() */
+       u64 delta = clocksource_delta(cycles, tkr->cycle_last, tkr->mask);
 
-       /* calculate the delta since the last update_wall_time */
-       delta = clocksource_delta(cycles, tkr->cycle_last, tkr->mask);
        return timekeeping_delta_to_ns(tkr, delta);
 }