Skip to content

Commit d5becdd

Browse files
author
Thomas Gleixner
committed
pps: Convert to ktime_get_snapshot_id()
ktime_get_snapshot() resolves to ktime_get_snapshot_id(CLOCK_REALTIME). Make it obvious in the code and convert the readout to use the snapshot::systime and monoraw fields instead of snapshot::real and raw, which aregoing away. Similar to the PPS generators, avoid the more expensive snapshot when CONFIG_NTP_PPS is disabled. No functional change intended. Signed-off-by: Thomas Gleixner <tglx@kernel.org> Tested-by: Arthur Kiyanovski <akiyano@amazon.com> Reviewed-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://patch.msgid.link/20260529195557.123410250@kernel.org
1 parent fe1159f commit d5becdd

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

include/linux/pps_kernel.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,14 @@ static inline void timespec_to_pps_ktime(struct pps_ktime *kt,
9999

100100
static inline void pps_get_ts(struct pps_event_time *ts)
101101
{
102+
#ifdef CONFIG_NTP_PPS
102103
struct system_time_snapshot snap;
103104

104-
ktime_get_snapshot(&snap);
105-
ts->ts_real = ktime_to_timespec64(snap.real);
106-
#ifdef CONFIG_NTP_PPS
107-
ts->ts_raw = ktime_to_timespec64(snap.raw);
105+
ktime_get_snapshot_id(CLOCK_REALTIME, &snap);
106+
ts->ts_real = ktime_to_timespec64(snap.systime);
107+
ts->ts_raw = ktime_to_timespec64(snap.monoraw);
108+
#else
109+
ktime_get_real_ts64(&ts->ts_real);
108110
#endif
109111
}
110112

0 commit comments

Comments
 (0)