Re: [patch 04/24] pps: Convert to ktime_get_snapshot_id()

From
Thomas Weißschuh <hidden>
Date
2026-05-27 07:02:10
Also in
kvmarm, linux-sound, linux-wireless, lkml, virtualization
Reply to
Thomas Gleixner, 2026-05-26
On Tue, May 26, 2026 at 07:13:48PM +0200, Thomas Gleixner wrote:
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::sys field instead of snapshot::real, which is going 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>
Cc: Rodolfo Giometti <giometti@enneenne.com>
Reviewed-by: Thomas Weißschuh <redacted>
quoted hunk ↗ jump to hunk
---
 include/linux/pps_kernel.h |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
--- a/include/linux/pps_kernel.h
+++ b/include/linux/pps_kernel.h
@@ -99,12 +99,14 @@ static inline void timespec_to_pps_ktime
 
 static inline void pps_get_ts(struct pps_event_time *ts)
 {
+#ifdef CONFIG_NTP_PPS
IS_ENABLED()?
quoted hunk ↗ jump to hunk
 	struct system_time_snapshot snap;
 
-	ktime_get_snapshot(&snap);
-	ts->ts_real = ktime_to_timespec64(snap.real);
-#ifdef CONFIG_NTP_PPS
+	ktime_get_snapshot_id(&snap, CLOCK_REALTIME);
+	ts->ts_real = ktime_to_timespec64(snap.sys);
 	ts->ts_raw = ktime_to_timespec64(snap.raw);
+#else
+	ktime_get_real_ts64(&ts->ts_real);
 #endif
 }
 
Thread (86 messages) 86 messages, 9 authors, last reply 2026-07-06
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help