diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2023-04-04 12:19:14 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-04-17 09:00:44 +0200 |
commit | 764c5889016510b9528c1276321bbd5b62043094 (patch) | |
tree | d8bfb6bd24a9c9ee9e60d28a19370070f13fc536 /include | |
parent | bcffedd4ff12323cad69995aaafb7f777e4fadaf (diff) | |
download | barebox-764c5889016510b9528c1276321bbd5b62043094.tar.gz |
clock: implement CLOCKSOURCE_MASK in terms of GENMASK_ULL
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>
Link: https://lore.barebox.org/20230404101914.2244083-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/clock.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/clock.h b/include/clock.h index 8e07c35d37..03a38911a7 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; |