[PATCH 1/2] clock: make SECOND/MSECOND/USECOND constants a constant expression

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Jul 1 06:18:01 PDT 2025


This makes the constants potentially usable in more places than before.

While at it, move the definitions to the start of the header to make them
usable within.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 include/clock.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/clock.h b/include/clock.h
index e28870b1e84b..db20877571a4 100644
--- a/include/clock.h
+++ b/include/clock.h
@@ -6,6 +6,12 @@
 #include <linux/time.h>
 #include <linux/bitops.h>
 
+#define SECOND (1000ULL * 1000 * 1000)
+#define MSECOND (1000ULL * 1000)
+#define USECOND (1000ULL)
+
+#define HZ	SECOND
+
 #define CLOCKSOURCE_MASK(bits) GENMASK_ULL((bits) - 1, 0)
 
 struct clocksource {
@@ -51,12 +57,6 @@ static inline void clocksource_srand(void)
 }
 #endif
 
-#define SECOND ((uint64_t)(1000 * 1000 * 1000))
-#define MSECOND ((uint64_t)(1000 * 1000))
-#define USECOND ((uint64_t)(1000))
-
-#define HZ	SECOND
-
 extern uint64_t time_beginning;
 
 /*
-- 
2.39.5




More information about the barebox mailing list