From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] clock: implement CLOCKSOURCE_MASK in terms of GENMASK_ULL
Date: Tue, 4 Apr 2023 12:19:14 +0200 [thread overview]
Message-ID: <20230404101914.2244083-1-a.fatoum@pengutronix.de> (raw)
Clang doesn't like our implementation of CLOCKSOURCE_MASK:
common/clock.c:33:10: warning: shift count >= width of type [-Wshift-count-overflow]
.mask = CLOCKSOURCE_MASK(64),
^~~~~~~~~~~~~~~~~~~~
include/clock.h:8:63: note: expanded from macro 'CLOCKSOURCE_MASK'
#define CLOCKSOURCE_MASK(bits) (uint64_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
So the bits < 64 check we have is apparently not enough to suppress the
warning when built with clang.
Let's do what the kernel does and use GENMASK_ULL instead to get rid of
the last remaining warning when building ARCH=sandbox targettools_defconfig
with clang version 16.0.1.
Not functional change intended.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/clock.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/clock.h b/include/clock.h
index 8e07c35d374e..03a38911a7a7 100644
--- a/include/clock.h
+++ b/include/clock.h
@@ -4,8 +4,9 @@
#include <types.h>
#include <linux/time.h>
+#include <linux/bitops.h>
-#define CLOCKSOURCE_MASK(bits) (uint64_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
+#define CLOCKSOURCE_MASK(bits) GENMASK_ULL((bits) - 1, 0)
struct clocksource {
uint32_t shift;
--
2.39.2
next reply other threads:[~2023-04-04 10:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 10:19 Ahmad Fatoum [this message]
2023-04-11 13:13 ` 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=20230404101914.2244083-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