Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bits: split the definition of the asm and non-asm GENMASK*()

In an upcoming change, the non-asm GENMASK*() will all be unified to
depend on GENMASK_TYPE() which indirectly depend on sizeof(), something
not available in asm.

Instead of adding further complexity to GENMASK_TYPE() to make it work
for both asm and non asm, just split the definition of the two variants.

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>

authored by

Vincent Mailhol and committed by
Yury Norov
6d447125 b0c85e99

+7 -6
+7 -6
include/linux/bits.h
··· 35 35 36 36 #define GENMASK_INPUT_CHECK(h, l) BUILD_BUG_ON_ZERO(const_true((l) > (h))) 37 37 38 + #define GENMASK(h, l) \ 39 + (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) 40 + #define GENMASK_ULL(h, l) \ 41 + (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l)) 42 + 38 43 /* 39 44 * Generate a mask for the specified type @t. Additional checks are made to 40 45 * guarantee the value returned fits in that type, relying on ··· 84 79 * BUILD_BUG_ON_ZERO is not available in h files included from asm files, 85 80 * disable the input check if that is the case. 86 81 */ 87 - #define GENMASK_INPUT_CHECK(h, l) 0 82 + #define GENMASK(h, l) __GENMASK(h, l) 83 + #define GENMASK_ULL(h, l) __GENMASK_ULL(h, l) 88 84 89 85 #endif /* !defined(__ASSEMBLY__) */ 90 - 91 - #define GENMASK(h, l) \ 92 - (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) 93 - #define GENMASK_ULL(h, l) \ 94 - (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l)) 95 86 96 87 #if !defined(__ASSEMBLY__) 97 88 /*