[Intel-gfx] [PATCH] drm/i915: Enclose for_each_engine_masked macro arguments in parentheses

Chris Wilson chris at chris-wilson.co.uk
Fri Apr 6 09:29:36 UTC 2018


Quoting Tvrtko Ursulin (2018-04-06 10:24:17)
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> Enclose for_each_engine_masked macro arguments in parentheses.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 5373b171bb96..79dc715db26b 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2149,8 +2149,8 @@ static inline struct drm_i915_private *huc_to_i915(struct intel_huc *huc)
>  
>  /* Iterator over subset of engines selected by mask */
>  #define for_each_engine_masked(engine__, dev_priv__, mask__, tmp__) \
> -       for (tmp__ = mask__ & INTEL_INFO(dev_priv__)->ring_mask;        \
> -            tmp__ ? (engine__ = (dev_priv__)->engine[__mask_next_bit(tmp__)]), 1 : 0; )
> +       for ((tmp__) = (mask__) & INTEL_INFO(dev_priv__)->ring_mask; \
> +            (tmp__) ? ((engine__) = (dev_priv__)->engine[__mask_next_bit(tmp__)]), 1 : 0; )

engine__ is a rhs, it can't have side-effects. Nor tmp__. Doesn't
enclosing in () just make the error even more opaque?
-Chris


More information about the Intel-gfx mailing list