[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: introduce macros to define register contents (rev3)

Patchwork patchwork at emeril.freedesktop.org
Wed Feb 27 17:44:33 UTC 2019


== Series Details ==

Series: drm/i915: introduce macros to define register contents (rev3)
URL   : https://patchwork.freedesktop.org/series/50513/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
918ed22b15ea drm/i915: introduce REG_BIT() and REG_GENMASK() to define register contents
-:91: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__n' - possible side-effects?
#91: FILE: drivers/gpu/drm/i915/i915_reg.h:127:
+#define REG_BIT(__n)							\
+	((u32)(BIT(__n) +						\
+	       BUILD_BUG_ON_ZERO(__builtin_constant_p(__n) &&		\
+				 ((__n) < 0 || (__n) > 31))))

-:105: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__high' - possible side-effects?
#105: FILE: drivers/gpu/drm/i915/i915_reg.h:141:
+#define REG_GENMASK(__high, __low)					\
+	((u32)(GENMASK(__high, __low) +					\
+	       BUILD_BUG_ON_ZERO(__builtin_constant_p(__high) &&	\
+				 __builtin_constant_p(__low) &&		\
+				 ((__low) < 0 || (__high) > 31 || (__low) > (__high)))))

-:105: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__low' - possible side-effects?
#105: FILE: drivers/gpu/drm/i915/i915_reg.h:141:
+#define REG_GENMASK(__high, __low)					\
+	((u32)(GENMASK(__high, __low) +					\
+	       BUILD_BUG_ON_ZERO(__builtin_constant_p(__high) &&	\
+				 __builtin_constant_p(__low) &&		\
+				 ((__low) < 0 || (__high) > 31 || (__low) > (__high)))))

total: 0 errors, 0 warnings, 3 checks, 169 lines checked
1e626607f4fd drm/i915: deprecate _SHIFT in favor of _MASK passed to accessors
81637c300f08 drm/i915: use REG_FIELD_PREP() to define register bitfield values
-:73: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__x' - possible side-effects?
#73: FILE: drivers/gpu/drm/i915/i915_reg.h:150:
+#define IS_POWER_OF_2(__x)		((__x) && (((__x) & ((__x) - 1)) == 0))

-:88: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__mask' - possible side-effects?
#88: FILE: drivers/gpu/drm/i915/i915_reg.h:162:
+#define REG_FIELD_PREP(__mask, __val)						\
+	((u32)((((typeof(__mask))(__val) << __bf_shf(__mask)) & (__mask)) +	\
+	       BUILD_BUG_ON_ZERO(!__builtin_constant_p(__mask)) +		\
+	       BUILD_BUG_ON_ZERO((__mask) == 0 || (__mask) > U32_MAX) +		\
+	       BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL << __bf_shf(__mask)))) + \
+	       BUILD_BUG_ON_ZERO(__builtin_choose_expr(__builtin_constant_p(__val), (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))

-:88: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__val' - possible side-effects?
#88: FILE: drivers/gpu/drm/i915/i915_reg.h:162:
+#define REG_FIELD_PREP(__mask, __val)						\
+	((u32)((((typeof(__mask))(__val) << __bf_shf(__mask)) & (__mask)) +	\
+	       BUILD_BUG_ON_ZERO(!__builtin_constant_p(__mask)) +		\
+	       BUILD_BUG_ON_ZERO((__mask) == 0 || (__mask) > U32_MAX) +		\
+	       BUILD_BUG_ON_ZERO(!IS_POWER_OF_2((__mask) + (1ULL << __bf_shf(__mask)))) + \
+	       BUILD_BUG_ON_ZERO(__builtin_choose_expr(__builtin_constant_p(__val), (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))

-:93: WARNING:LONG_LINE: line over 100 characters
#93: FILE: drivers/gpu/drm/i915/i915_reg.h:167:
+	       BUILD_BUG_ON_ZERO(__builtin_choose_expr(__builtin_constant_p(__val), (~((__mask) >> __bf_shf(__mask)) & (__val)), 0))))

total: 0 errors, 1 warnings, 3 checks, 114 lines checked



More information about the Intel-gfx mailing list