[Concept,16/16] ext4l: Add asm-generic/timex.h and move get_cycles

Message ID 20260119214846.3087611-17-sjg@u-boot.org
State New
Headers
Series ext4l: Move definitions to standard Linux headers |

Commit Message

Simon Glass Jan. 19, 2026, 9:48 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Create include/asm-generic/timex.h with the get_cycles() macro that
returns 0 (U-Boot doesn't have a cycle counter).

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/asm-generic/timex.h | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100644 include/asm-generic/timex.h
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index 49405877133..eadff92aecb 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -1322,8 +1322,8 @@  static inline unsigned long ext4_find_next_bit_le(const void *addr,
 
 /* atomic64 operations are now in asm-generic/atomic.h */
 
-/* CPU cycle counter stub */
-#define get_cycles()			(0ULL)
+/* get_cycles is in asm-generic/timex.h */
+#include <asm-generic/timex.h>
 
 /* folio_address is in linux/pagemap.h */
 
diff --git a/include/asm-generic/timex.h b/include/asm-generic/timex.h
new file mode 100644
index 00000000000..005befd6b6d
--- /dev/null
+++ b/include/asm-generic/timex.h
@@ -0,0 +1,21 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Generic timex definitions for U-Boot
+ *
+ * Based on Linux asm-generic/timex.h
+ */
+#ifndef _ASM_GENERIC_TIMEX_H
+#define _ASM_GENERIC_TIMEX_H
+
+typedef unsigned long long cycles_t;
+
+/**
+ * get_cycles() - Get CPU cycle counter
+ *
+ * U-Boot doesn't have a cycle counter, so return 0.
+ *
+ * Return: 0 (stub)
+ */
+#define get_cycles()	(0ULL)
+
+#endif /* _ASM_GENERIC_TIMEX_H */