Re: [PATCH] drm/i915: Update wa_ctx_emit() macro as per kernel coding guidelines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 08, 2015 at 10:27:05AM +0100, Arun Siluvery wrote:
> 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@xxxxxxxxx>
> Cc: Robert Beckett <robert.beckett@xxxxxxxxx>
> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Cc: Imre Deak <imre.deak@xxxxxxxxx>
> Signed-off-by: Arun Siluvery <arun.siluvery@xxxxxxxxxxxxxxx>

Simple mechanical change,
Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux