Skip to content

Commit ab7529f

Browse files
committed
drm/i915: Use __is_constexpr()
gcc-4.8 and older dislike the use of __builtin_constant_p() within a constant expression context, and so we must use the magical __is_constexpr() instead. For example, with gcc-4.8.5: ../drivers/gpu/drm/i915/i915_reg.h:167:27: error: first argument to ‘__builtin_choose_expr’ not a constant ../include/linux/build_bug.h:16:45: error: bit-field ‘<anonymous>’ width not an integer constant Reported-by: Randy Dunlap <[email protected]> Reported-by: Uma Shankar <[email protected]> Fixes: baa09e7 ("drm/i915: use REG_FIELD_PREP() to define register bitfield values") Signed-off-by: Chris Wilson <[email protected]> Cc: Jani Nikula <[email protected]> Cc: Imre Deak <[email protected]> Cc: Randy Dunlap <[email protected]> Acked-by: Randy Dunlap <[email protected]> # build-tested Reviewed-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 6ebc969 commit ab7529f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@
161161
*/
162162
#define REG_FIELD_PREP(__mask, __val) \
163163
((u32)((((typeof(__mask))(__val) << __bf_shf(__mask)) & (__mask)) + \
164-
BUILD_BUG_ON_ZERO(!__builtin_constant_p(__mask)) + \
164+
BUILD_BUG_ON_ZERO(!__is_constexpr(__mask)) + \
165165
BUILD_BUG_ON_ZERO((__mask) == 0 || (__mask) > U32_MAX) + \
166166
BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL << __bf_shf(__mask)))) + \
167-
BUILD_BUG_ON_ZERO(__builtin_choose_expr(__builtin_constant_p(__val), (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))
167+
BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val), (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))
168168

169169
/**
170170
* REG_FIELD_GET() - Extract a u32 bitfield value

0 commit comments

Comments
 (0)