[Concept,07/17] ext4l: Move time functions to linux/time.h

Message ID 20260120234344.495605-8-sjg@u-boot.org
State New
Headers
Series ext4l: Move compatibility stubs to standard Linux headers |

Commit Message

Simon Glass Jan. 20, 2026, 11:43 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Add ktime_get_real_seconds() and time_before32() to linux/time.h where
they belong in the Linux kernel header hierarchy. This removes these
stubs from ext4_uboot.h.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 fs/ext4l/ext4_uboot.h |  4 +---
 include/linux/time.h  | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index 09e58989888..d1ec4a84b97 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -229,9 +229,7 @@  struct buffer_head *sb_getblk(struct super_block *sb, sector_t block);
 #define sb_find_get_block(sb, block)		((struct buffer_head *)NULL)
 #define sync_dirty_buffer(bh)			submit_bh(REQ_OP_WRITE, bh)
 
-/* Time functions - use boot-relative time for timestamps */
-#define ktime_get_real_seconds()		(get_timer(0) / 1000)
-#define time_before32(a, b)			(0)
+/* Time functions - ktime_get_real_seconds, time_before32 are in linux/time.h */
 
 /* Inode operations - iget_locked and new_inode are in interface.c */
 extern struct inode *new_inode(struct super_block *sb);
diff --git a/include/linux/time.h b/include/linux/time.h
index b23598295c2..17471d2c26c 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -174,4 +174,18 @@  struct timespec64 {
 	long tv_nsec;
 };
 
+/*
+ * time_before32 - check if 32-bit time @b is before time @a
+ *
+ * U-Boot stub - time comparison not supported, always returns false.
+ */
+#define time_before32(b, a)	(0)
+
+/*
+ * ktime_get_real_seconds - get current wall-clock time in seconds
+ *
+ * U-Boot implementation uses get_timer() to return boot-relative time.
+ */
+#define ktime_get_real_seconds()	(get_timer(0) / 1000)
+
 #endif