mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/2] clock: make SECOND/MSECOND/USECOND constants a constant expression
Date: Tue,  1 Jul 2025 15:18:01 +0200	[thread overview]
Message-ID: <20250701131802.465283-1-a.fatoum@pengutronix.de> (raw)

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@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




             reply	other threads:[~2025-07-01 14:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-01 13:18 Ahmad Fatoum [this message]
2025-07-01 13:18 ` [PATCH 2/2] console: fix loose coupling between getchar and is_timeout delays Ahmad Fatoum
2025-07-02  6:35 ` [PATCH 1/2] clock: make SECOND/MSECOND/USECOND constants a constant expression Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250701131802.465283-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox