Skip to content

Commit 6d44712

Browse files
vincent-mailholYuryNorov
authored andcommitted
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 <[email protected]> Reviewed-by: Lucas De Marchi <[email protected]> Signed-off-by: Yury Norov (NVIDIA) <[email protected]>
1 parent b0c85e9 commit 6d44712

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

include/linux/bits.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535

3636
#define GENMASK_INPUT_CHECK(h, l) BUILD_BUG_ON_ZERO(const_true((l) > (h)))
3737

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+
3843
/*
3944
* Generate a mask for the specified type @t. Additional checks are made to
4045
* guarantee the value returned fits in that type, relying on
@@ -79,15 +84,11 @@
7984
* BUILD_BUG_ON_ZERO is not available in h files included from asm files,
8085
* disable the input check if that is the case.
8186
*/
82-
#define GENMASK_INPUT_CHECK(h, l) 0
87+
#define GENMASK(h, l) __GENMASK(h, l)
88+
#define GENMASK_ULL(h, l) __GENMASK_ULL(h, l)
8389

8490
#endif /* !defined(__ASSEMBLY__) */
8591

86-
#define GENMASK(h, l) \
87-
(GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
88-
#define GENMASK_ULL(h, l) \
89-
(GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
90-
9192
#if !defined(__ASSEMBLY__)
9293
/*
9394
* Missing asm support

0 commit comments

Comments
 (0)