mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-05 01:54:09 +08:00
timekeeping: Introduce tkd_basic_setup() to make lock and seqcount init reusable
Initialization of lock and seqcount needs to be done for every instance of timekeeper struct. To be able to easily reuse it, create a separate function for it. 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/20241009-devel-anna-maria-b4-timers-ptp-timekeeping-v2-11-554456a44a15@linutronix.de
This commit is contained in:
parent
10f7c178a9
commit
a5f9e4e4ef
@ -1765,6 +1765,12 @@ read_persistent_wall_and_boot_offset(struct timespec64 *wall_time,
|
|||||||
*boot_offset = ns_to_timespec64(local_clock());
|
*boot_offset = ns_to_timespec64(local_clock());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __init void tkd_basic_setup(struct tk_data *tkd)
|
||||||
|
{
|
||||||
|
raw_spin_lock_init(&tkd->lock);
|
||||||
|
seqcount_raw_spinlock_init(&tkd->seq, &tkd->lock);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flag reflecting whether timekeeping_resume() has injected sleeptime.
|
* Flag reflecting whether timekeeping_resume() has injected sleeptime.
|
||||||
*
|
*
|
||||||
@ -1792,8 +1798,7 @@ void __init timekeeping_init(void)
|
|||||||
struct timekeeper *tk = &tk_core.timekeeper;
|
struct timekeeper *tk = &tk_core.timekeeper;
|
||||||
struct clocksource *clock;
|
struct clocksource *clock;
|
||||||
|
|
||||||
raw_spin_lock_init(&tk_core.lock);
|
tkd_basic_setup(&tk_core);
|
||||||
seqcount_raw_spinlock_init(&tk_core.seq, &tkd->lock);
|
|
||||||
|
|
||||||
read_persistent_wall_and_boot_offset(&wall_time, &boot_offset);
|
read_persistent_wall_and_boot_offset(&wall_time, &boot_offset);
|
||||||
if (timespec64_valid_settod(&wall_time) &&
|
if (timespec64_valid_settod(&wall_time) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user