diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2023-11-22 18:29:34 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-11-23 15:45:54 +0100 |
commit | 6b995b15592565a560253de88951cdd348c906dd (patch) | |
tree | cf4b828d4c3ddf3a601127e1c44450dc2f85144b /include/linux/bitops.h | |
parent | b686114ba03d9d6a222ca21384ea8534f77a1af4 (diff) | |
download | barebox-6b995b15592565a560253de88951cdd348c906dd.tar.gz barebox-6b995b15592565a560253de88951cdd348c906dd.tar.xz |
bitops: split off linux/bits.h
The bit definitions are split off in Linux into <linux/bits.h>, which
is included by <linux/bitops.h> and extended with bit operations.
Follow through in barebox to simplify porting kernel code and in future
to speed up the build a bit by avoiding pulling in the whole bitops.h,
when only needing macros like BIT().
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20231122172951.376531-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/linux/bitops.h')
-rw-r--r-- | include/linux/bitops.h | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index b0d6ca6ac8..7646e15634 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -5,15 +5,9 @@ #include <linux/types.h> #include <linux/const.h> +#include <linux/bits.h> #ifdef __KERNEL__ -#define BIT(nr) (UL(1) << (nr)) -#define BIT_ULL(nr) (ULL(1) << (nr)) -#define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG)) -#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) -#define BIT_ULL_MASK(nr) (ULL(1) << ((nr) % BITS_PER_LONG_LONG)) -#define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG) -#define BITS_PER_BYTE 8 #define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long)) #define BITS_TO_U64(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(u64)) @@ -22,19 +16,6 @@ #define BYTES_TO_BITS(nb) (((BITS_PER_LONG * (nb)) / sizeof(long))) #endif -/* - * Create a contiguous bitmask starting at bit position @l and ending at - * position @h. For example - * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. - */ -#define GENMASK(h, l) \ - (((~UL(0)) - (UL(1) << (l)) + 1) & \ - (~UL(0) >> (BITS_PER_LONG - 1 - (h)))) - -#define GENMASK_ULL(h, l) \ - (((~ULL(0)) - (ULL(1) << (l)) + 1) & \ - (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h)))) - #ifndef __ASSEMBLY__ /* * Include this here because some architectures need generic_ffs/fls in |