Skip to content

Commit 926ad47

Browse files
anna-marialxKAGA-KOKO
authored andcommitted
timekeeping: Make __timekeeping_advance() reusable
In __timekeeping_advance() the pointer to struct tk_data is hardcoded by the use of &tk_core. As long as there is only a single timekeeper (tk_core), this is not a problem. But when __timekeeping_advance() will be reused for per auxiliary timekeepers, __timekeeping_advance() needs to be generalized. Add a pointer to struct tk_data as function argument of __timekeeping_advance() and adapt all call sites. Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: John Stultz <jstultz@google.com> Link: https://lore.kernel.org/all/20250519083026.160967312@linutronix.de
1 parent c7ebfbc commit 926ad47

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

kernel/time/timekeeping.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,10 +2196,10 @@ static u64 logarithmic_accumulation(struct timekeeper *tk, u64 offset,
21962196
* timekeeping_advance - Updates the timekeeper to the current time and
21972197
* current NTP tick length
21982198
*/
2199-
static bool __timekeeping_advance(enum timekeeping_adv_mode mode)
2199+
static bool __timekeeping_advance(struct tk_data *tkd, enum timekeeping_adv_mode mode)
22002200
{
2201-
struct timekeeper *tk = &tk_core.shadow_timekeeper;
2202-
struct timekeeper *real_tk = &tk_core.timekeeper;
2201+
struct timekeeper *tk = &tkd->shadow_timekeeper;
2202+
struct timekeeper *real_tk = &tkd->timekeeper;
22032203
unsigned int clock_set = 0;
22042204
int shift = 0, maxshift;
22052205
u64 offset, orig_offset;
@@ -2252,15 +2252,15 @@ static bool __timekeeping_advance(enum timekeeping_adv_mode mode)
22522252
if (orig_offset != offset)
22532253
tk_update_coarse_nsecs(tk);
22542254

2255-
timekeeping_update_from_shadow(&tk_core, clock_set);
2255+
timekeeping_update_from_shadow(tkd, clock_set);
22562256

22572257
return !!clock_set;
22582258
}
22592259

22602260
static bool timekeeping_advance(enum timekeeping_adv_mode mode)
22612261
{
22622262
guard(raw_spinlock_irqsave)(&tk_core.lock);
2263-
return __timekeeping_advance(mode);
2263+
return __timekeeping_advance(&tk_core, mode);
22642264
}
22652265

22662266
/**
@@ -2598,7 +2598,7 @@ int do_adjtimex(struct __kernel_timex *txc)
25982598

25992599
/* Update the multiplier immediately if frequency was set directly */
26002600
if (txc->modes & (ADJ_FREQUENCY | ADJ_TICK))
2601-
clock_set |= __timekeeping_advance(TK_ADV_FREQ);
2601+
clock_set |= __timekeeping_advance(&tk_core, TK_ADV_FREQ);
26022602
}
26032603

26042604
if (txc->modes & ADJ_SETOFFSET)

0 commit comments

Comments
 (0)