drm/i915: Update wa_ctx_emit() macro as per kernel coding guidelines
authorArun Siluvery <arun.siluvery@linux.intel.com>
Wed, 8 Jul 2015 09:27:05 +0000 (10:27 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 8 Jul 2015 15:24:14 +0000 (17:24 +0200)
commit83b8a982b101c48fc025066a7b08beaf6fa756f0
tree917e251cd40c134bd51ac7ca336b1e065aac0d0d
parentaaf5ec2e51ab1d9c5e962b4728a1107ed3ff7a3e
drm/i915: Update wa_ctx_emit() macro as per kernel coding guidelines

wa_ctx_emit() depends on the name of a local variable; if the name of that
variable is changed then we get compile errors. In this case it is unlikely
to be changed as this macro is only used in this set of functions but
Kernel coding guidelines doesn't recommend doing this. It was my mistake
as I should have corrected it at the beginning but missed so correct
this before there are more usages of this macro (Bob Beckett).

https://www.kernel.org/doc/Documentation/CodingStyle,
Chapter 12, "Things to avoid when using macros", point 2):

"
2) macros that depend on having a local variable with a magic name:

   #define FOO(val) bar(index, val)

might look like a good thing, but it's confusing as hell when one reads the
code and it's prone to breakage from seemingly innocent changes.
"

v2: Optimization to avoid multiple evaluation of 'index' in the macro.
Since we invoke it multiple times, compiler, if it can, should be able to coalesce
them into a single condition and remove multiple WARN_ON checks (Chris).

Suggested-by: Robert Beckett <robert.beckett@intel.com>
Cc: Robert Beckett <robert.beckett@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Imre Deak <imre.deak@intel.com>
Signed-off-by: Arun Siluvery <arun.siluvery@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_lrc.c
This page took 0.031356 seconds and 5 git commands to generate.