* [PATCH 0/2] timekeeping: Annotate auxiliary clock accessors with __must_check
@ 2026-07-31 14:20 Thomas Weißschuh (Schneider Electric)
2026-07-31 14:20 ` [PATCH 1/2] timekeeping: Remove the unused ktime_get_clock_ts64() Thomas Weißschuh (Schneider Electric)
2026-07-31 14:20 ` [PATCH 2/2] timekeeping: Annotate auxiliary clock accessors with __must_check Thomas Weißschuh (Schneider Electric)
0 siblings, 2 replies; 5+ messages in thread
From: Thomas Weißschuh (Schneider Electric) @ 2026-07-31 14:20 UTC (permalink / raw)
To: John Stultz, Thomas Gleixner, Stephen Boyd, Richard Cochran,
Miroslav Lichvar
Cc: linux-kernel, netdev, Thomas Weißschuh (Schneider Electric)
In contrast to the classic time accessors, the ones for auxiliary clocks
can fail.
Make sure the callers check for this.
Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
---
Thomas Weißschuh (Schneider Electric) (2):
timekeeping: Remove the unused ktime_get_clock_ts64()
timekeeping: Annotate auxiliary clock accessors with __must_check
include/linux/timekeeping.h | 12 +++++++-----
kernel/time/timekeeping.c | 34 ----------------------------------
2 files changed, 7 insertions(+), 39 deletions(-)
---
base-commit: ecc330e3096173f433659aa64ab3674d0d48440e
change-id: 20260622-timekeeping-aux-must-check-1db2a27cceb0
Best regards,
--
Thomas Weißschuh <thomas.weissschuh@linutronix.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] timekeeping: Remove the unused ktime_get_clock_ts64()
2026-07-31 14:20 [PATCH 0/2] timekeeping: Annotate auxiliary clock accessors with __must_check Thomas Weißschuh (Schneider Electric)
@ 2026-07-31 14:20 ` Thomas Weißschuh (Schneider Electric)
2026-08-11 9:16 ` [tip: timers/core] " tip-bot2 for Thomas Weißschuh (Schneider Electric)
2026-07-31 14:20 ` [PATCH 2/2] timekeeping: Annotate auxiliary clock accessors with __must_check Thomas Weißschuh (Schneider Electric)
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Weißschuh (Schneider Electric) @ 2026-07-31 14:20 UTC (permalink / raw)
To: John Stultz, Thomas Gleixner, Stephen Boyd, Richard Cochran,
Miroslav Lichvar
Cc: linux-kernel, netdev, Thomas Weißschuh (Schneider Electric)
The last user was removed in commit a6d799608e6a ("ptp: Switch to
ktime_get_snapshot_id() for pre/post timestamps").
Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
---
include/linux/timekeeping.h | 1 -
kernel/time/timekeeping.c | 34 ----------------------------------
2 files changed, 35 deletions(-)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index b4191a873c39..ca4a881e622f 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -44,7 +44,6 @@ extern void ktime_get_ts64(struct timespec64 *ts);
extern void ktime_get_real_ts64(struct timespec64 *tv);
extern void ktime_get_coarse_ts64(struct timespec64 *ts);
extern void ktime_get_coarse_real_ts64(struct timespec64 *ts);
-extern void ktime_get_clock_ts64(clockid_t id, struct timespec64 *ts);
/* Multigrain timestamp interfaces */
extern void ktime_get_coarse_real_ts64_mg(struct timespec64 *ts);
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 97db2e9393f9..29b2a38b27b4 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1937,40 +1937,6 @@ void ktime_get_raw_ts64(struct timespec64 *ts)
}
EXPORT_SYMBOL(ktime_get_raw_ts64);
-/**
- * ktime_get_clock_ts64 - Returns time of a clock in a timespec
- * @id: POSIX clock ID of the clock to read
- * @ts: Pointer to the timespec64 to be set
- *
- * The timestamp is invalidated (@ts->sec is set to -1) if the
- * clock @id is not available.
- */
-void ktime_get_clock_ts64(clockid_t id, struct timespec64 *ts)
-{
- /* Invalidate time stamp */
- ts->tv_sec = -1;
- ts->tv_nsec = 0;
-
- switch (id) {
- case CLOCK_REALTIME:
- ktime_get_real_ts64(ts);
- return;
- case CLOCK_MONOTONIC:
- ktime_get_ts64(ts);
- return;
- case CLOCK_MONOTONIC_RAW:
- ktime_get_raw_ts64(ts);
- return;
- case CLOCK_AUX ... CLOCK_AUX_LAST:
- if (IS_ENABLED(CONFIG_POSIX_AUX_CLOCKS))
- ktime_get_aux_ts64(id, ts);
- return;
- default:
- WARN_ON_ONCE(1);
- }
-}
-EXPORT_SYMBOL_GPL(ktime_get_clock_ts64);
-
/**
* timekeeping_valid_for_hres - Check if timekeeping is suitable for hres
*/
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] timekeeping: Annotate auxiliary clock accessors with __must_check
2026-07-31 14:20 [PATCH 0/2] timekeeping: Annotate auxiliary clock accessors with __must_check Thomas Weißschuh (Schneider Electric)
2026-07-31 14:20 ` [PATCH 1/2] timekeeping: Remove the unused ktime_get_clock_ts64() Thomas Weißschuh (Schneider Electric)
@ 2026-07-31 14:20 ` Thomas Weißschuh (Schneider Electric)
2026-08-11 9:16 ` [tip: timers/core] " tip-bot2 for Thomas Weißschuh (Schneider Electric)
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Weißschuh (Schneider Electric) @ 2026-07-31 14:20 UTC (permalink / raw)
To: John Stultz, Thomas Gleixner, Stephen Boyd, Richard Cochran,
Miroslav Lichvar
Cc: linux-kernel, netdev, Thomas Weißschuh (Schneider Electric)
In contrast to the classic time accessors, the ones for auxiliary clocks
can fail.
Make sure the callers check for this.
Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
---
include/linux/timekeeping.h | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index ca4a881e622f..561313b5cb6d 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -267,11 +267,14 @@ extern void timekeeping_inject_sleeptime64(const struct timespec64 *delta);
* Auxiliary clock interfaces
*/
#ifdef CONFIG_POSIX_AUX_CLOCKS
-extern bool ktime_get_aux(clockid_t id, ktime_t *kt);
-extern bool ktime_get_aux_ts64(clockid_t id, struct timespec64 *kt);
+extern bool __must_check ktime_get_aux(clockid_t id, ktime_t *kt);
+extern bool __must_check ktime_get_aux_ts64(clockid_t id, struct timespec64 *kt);
#else
-static inline bool ktime_get_aux(clockid_t id, ktime_t *kt) { return false; }
-static inline bool ktime_get_aux_ts64(clockid_t id, struct timespec64 *kt) { return false; }
+static inline bool __must_check ktime_get_aux(clockid_t id, ktime_t *kt) { return false; }
+static inline bool __must_check ktime_get_aux_ts64(clockid_t id, struct timespec64 *kt)
+{
+ return false;
+}
#endif
/**
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip: timers/core] timekeeping: Annotate auxiliary clock accessors with __must_check
2026-07-31 14:20 ` [PATCH 2/2] timekeeping: Annotate auxiliary clock accessors with __must_check Thomas Weißschuh (Schneider Electric)
@ 2026-08-11 9:16 ` tip-bot2 for Thomas Weißschuh (Schneider Electric)
0 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Thomas Weißschuh (Schneider Electric) @ 2026-08-11 9:16 UTC (permalink / raw)
To: linux-tip-commits; +Cc: thomas.weissschuh, Thomas Gleixner, x86, linux-kernel
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 2838bdb772e4e94591a90437bf595dba485a3162
Gitweb: https://git.kernel.org/tip/2838bdb772e4e94591a90437bf595dba485a3162
Author: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
AuthorDate: Fri, 31 Jul 2026 16:20:15 +02:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Tue, 11 Aug 2026 11:12:43 +02:00
timekeeping: Annotate auxiliary clock accessors with __must_check
In contrast to the system time accessors, the ones for auxiliary clocks can
fail.
Make sure the callers check for this.
Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260731-timekeeping-aux-must-check-v1-2-11ae93068497@linutronix.de
---
include/linux/timekeeping.h | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index ca4a881..561313b 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -267,11 +267,14 @@ extern void timekeeping_inject_sleeptime64(const struct timespec64 *delta);
* Auxiliary clock interfaces
*/
#ifdef CONFIG_POSIX_AUX_CLOCKS
-extern bool ktime_get_aux(clockid_t id, ktime_t *kt);
-extern bool ktime_get_aux_ts64(clockid_t id, struct timespec64 *kt);
+extern bool __must_check ktime_get_aux(clockid_t id, ktime_t *kt);
+extern bool __must_check ktime_get_aux_ts64(clockid_t id, struct timespec64 *kt);
#else
-static inline bool ktime_get_aux(clockid_t id, ktime_t *kt) { return false; }
-static inline bool ktime_get_aux_ts64(clockid_t id, struct timespec64 *kt) { return false; }
+static inline bool __must_check ktime_get_aux(clockid_t id, ktime_t *kt) { return false; }
+static inline bool __must_check ktime_get_aux_ts64(clockid_t id, struct timespec64 *kt)
+{
+ return false;
+}
#endif
/**
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip: timers/core] timekeeping: Remove the unused ktime_get_clock_ts64()
2026-07-31 14:20 ` [PATCH 1/2] timekeeping: Remove the unused ktime_get_clock_ts64() Thomas Weißschuh (Schneider Electric)
@ 2026-08-11 9:16 ` tip-bot2 for Thomas Weißschuh (Schneider Electric)
0 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Thomas Weißschuh (Schneider Electric) @ 2026-08-11 9:16 UTC (permalink / raw)
To: linux-tip-commits; +Cc: thomas.weissschuh, Thomas Gleixner, x86, linux-kernel
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 1b515771872174553fe70eadb8efecfa49035922
Gitweb: https://git.kernel.org/tip/1b515771872174553fe70eadb8efecfa49035922
Author: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
AuthorDate: Fri, 31 Jul 2026 16:20:14 +02:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Tue, 11 Aug 2026 11:12:43 +02:00
timekeeping: Remove the unused ktime_get_clock_ts64()
The last user was removed in commit a6d799608e6a ("ptp: Switch to
ktime_get_snapshot_id() for pre/post timestamps").
Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260731-timekeeping-aux-must-check-v1-1-11ae93068497@linutronix.de
---
include/linux/timekeeping.h | 1 -
kernel/time/timekeeping.c | 34 ----------------------------------
2 files changed, 35 deletions(-)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index b4191a8..ca4a881 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -44,7 +44,6 @@ extern void ktime_get_ts64(struct timespec64 *ts);
extern void ktime_get_real_ts64(struct timespec64 *tv);
extern void ktime_get_coarse_ts64(struct timespec64 *ts);
extern void ktime_get_coarse_real_ts64(struct timespec64 *ts);
-extern void ktime_get_clock_ts64(clockid_t id, struct timespec64 *ts);
/* Multigrain timestamp interfaces */
extern void ktime_get_coarse_real_ts64_mg(struct timespec64 *ts);
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index c1863f2..4e6d594 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1942,40 +1942,6 @@ void ktime_get_raw_ts64(struct timespec64 *ts)
EXPORT_SYMBOL(ktime_get_raw_ts64);
/**
- * ktime_get_clock_ts64 - Returns time of a clock in a timespec
- * @id: POSIX clock ID of the clock to read
- * @ts: Pointer to the timespec64 to be set
- *
- * The timestamp is invalidated (@ts->sec is set to -1) if the
- * clock @id is not available.
- */
-void ktime_get_clock_ts64(clockid_t id, struct timespec64 *ts)
-{
- /* Invalidate time stamp */
- ts->tv_sec = -1;
- ts->tv_nsec = 0;
-
- switch (id) {
- case CLOCK_REALTIME:
- ktime_get_real_ts64(ts);
- return;
- case CLOCK_MONOTONIC:
- ktime_get_ts64(ts);
- return;
- case CLOCK_MONOTONIC_RAW:
- ktime_get_raw_ts64(ts);
- return;
- case CLOCK_AUX ... CLOCK_AUX_LAST:
- if (IS_ENABLED(CONFIG_POSIX_AUX_CLOCKS))
- ktime_get_aux_ts64(id, ts);
- return;
- default:
- WARN_ON_ONCE(1);
- }
-}
-EXPORT_SYMBOL_GPL(ktime_get_clock_ts64);
-
-/**
* timekeeping_valid_for_hres - Check if timekeeping is suitable for hres
*/
int timekeeping_valid_for_hres(void)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-11 9:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-31 14:20 [PATCH 0/2] timekeeping: Annotate auxiliary clock accessors with __must_check Thomas Weißschuh (Schneider Electric)
2026-07-31 14:20 ` [PATCH 1/2] timekeeping: Remove the unused ktime_get_clock_ts64() Thomas Weißschuh (Schneider Electric)
2026-08-11 9:16 ` [tip: timers/core] " tip-bot2 for Thomas Weißschuh (Schneider Electric)
2026-07-31 14:20 ` [PATCH 2/2] timekeeping: Annotate auxiliary clock accessors with __must_check Thomas Weißschuh (Schneider Electric)
2026-08-11 9:16 ` [tip: timers/core] " tip-bot2 for Thomas Weißschuh (Schneider Electric)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®