[PATCH 1/2] include: ktime: move ktime_t definition globally

Ahmad Fatoum a.fatoum at barebox.org
Thu Apr 30 23:53:17 PDT 2026


To allow use of the type without including the ktime.h header, define it
in linux/types.h. This is also where Linux defines it.

Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
 include/linux/ktime.h | 4 +---
 include/linux/types.h | 3 +++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 2b9a91d5401c..483324a4444f 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -21,6 +21,7 @@
 #ifndef _LINUX_KTIME_H
 #define _LINUX_KTIME_H
 
+#include <linux/types.h>
 #include <linux/math.h>
 #include <linux/time.h>
 #include <clock.h>
@@ -31,9 +32,6 @@
 #define KTIME_SEC_MAX			(KTIME_MAX / NSEC_PER_SEC)
 #define KTIME_SEC_MIN			(KTIME_MIN / NSEC_PER_SEC)
 
-/* Nanosecond scalar representation for kernel time values */
-typedef s64	ktime_t;
-
 /**
  * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value
  * @secs:	seconds to set
diff --git a/include/linux/types.h b/include/linux/types.h
index 93e7fe46295f..6731b5a1b246 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -120,6 +120,9 @@ typedef		__u64		u_int64_t;
 typedef		__s64		int64_t;
 #endif
 
+/* Nanosecond scalar representation for kernel time values */
+typedef s64	ktime_t;
+
 #endif /* __KERNEL_STRICT_NAMES */
 
 /*
-- 
2.47.3




More information about the barebox mailing list