[Concept,20/34] ext4l: Move jiffies definitions to linux/jiffies.h
Commit Message
From: Simon Glass <simon.glass@canonical.com>
The ext4l code defines HZ, jiffies, msecs_to_jiffies(),
jiffies_to_msecs(), nsecs_to_jiffies(), and round_jiffies_up() locally
instead of in the common jiffies header.
Move these to linux/jiffies.h where they belong. Also remove the
redundant NSEC_PER_SEC definition since it is already in linux/time.h
Time comparison macros time_before() and time_after() are provided by
include/time.h which has a better implementation with typecheck()
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
fs/ext4l/ext4_uboot.h | 18 +++---------------
include/linux/jiffies.h | 14 ++++++++++++++
2 files changed, 17 insertions(+), 15 deletions(-)
@@ -1968,18 +1968,7 @@ struct fs_parse_result {
/* crc16 - use U-Boot's implementation */
#include <linux/crc16.h>
-/* Timer and timing stubs */
-#define HZ 1000
-#define jiffies 0UL
-#ifndef time_before
-#define time_before(a, b) ((long)((a) - (b)) < 0)
-#endif
-#ifndef time_after
-#define time_after(a, b) time_before(b, a)
-#endif
-#define msecs_to_jiffies(m) ((m) * HZ / 1000)
-#define jiffies_to_msecs(j) ((j) * 1000 / HZ)
-#define round_jiffies_up(j) (j)
+/* Timer and timing stubs are in linux/jiffies.h */
/* Path lookup flags */
#define LOOKUP_FOLLOW 0x0001
@@ -2022,8 +2011,7 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
/* Block size */
#define BLOCK_SIZE 1024
-/* Time constants */
-#define NSEC_PER_SEC 1000000000L
+/* NSEC_PER_SEC is in linux/time.h */
/* EXT4 magic number */
#define EXT4_SUPER_MAGIC 0xEF53
@@ -2115,7 +2103,7 @@ void *kvzalloc(size_t size, gfp_t flags);
/* Time operations */
#define ktime_get_ns() (0ULL)
-#define nsecs_to_jiffies(ns) ((ns) / (NSEC_PER_SEC / HZ))
+/* nsecs_to_jiffies is in linux/jiffies.h */
/* Superblock write operations */
#define sb_start_write_trylock(sb) ({ (void)(sb); 1; })
@@ -15,4 +15,18 @@
#define MAX_JIFFY_OFFSET ((LONG_MAX >> 1) - 1)
+/* HZ - timer frequency (simplified for U-Boot) */
+#define HZ 1000
+
+/* jiffies - always 0 in U-Boot (no timer tick counter) */
+#define jiffies 0UL
+
+/* Time comparison macros are in include/time.h */
+
+/* Jiffies conversion */
+#define msecs_to_jiffies(m) ((m) * HZ / 1000)
+#define jiffies_to_msecs(j) ((j) * 1000 / HZ)
+#define nsecs_to_jiffies(ns) ((ns) / (1000000000L / HZ))
+#define round_jiffies_up(j) (j)
+
#endif /* _LINUX_JIFFIES_H */