diff mbox

drm/i915: Enclose for_each_engine_masked macro arguments in parentheses

Message ID 20180406092417.2466-1-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tvrtko Ursulin April 6, 2018, 9:24 a.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Enclose for_each_engine_masked macro arguments in parentheses.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Chris Wilson April 6, 2018, 9:29 a.m. UTC | #1
Quoting Tvrtko Ursulin (2018-04-06 10:24:17)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Enclose for_each_engine_masked macro arguments in parentheses.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@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
Chris Wilson April 6, 2018, 9:30 a.m. UTC | #2
Quoting Chris Wilson (2018-04-06 10:29:36)
> Quoting Tvrtko Ursulin (2018-04-06 10:24:17)
> > From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > 
> > Enclose for_each_engine_masked macro arguments in parentheses.
> > 
> > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@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?

Lhs. Lhs! I'll be back after coffee.
-Chris
Chris Wilson April 6, 2018, 9:35 a.m. UTC | #3
Quoting Patchwork (2018-04-06 10:29:45)
> == Series Details ==
> 
> Series: drm/i915: Enclose for_each_engine_masked macro arguments in parentheses
> URL   : https://patchwork.freedesktop.org/series/41261/
> State : warning
> 
> == Summary ==
> 
> $ dim checkpatch origin/drm-tip
> e31cc0477730 drm/i915: Enclose for_each_engine_masked macro arguments in parentheses
> -:22: ERROR:SPACING: space prohibited before that close parenthesis ')'
> #22: FILE: drivers/gpu/drm/i915/i915_drv.h:2153:
> +            (tmp__) ? ((engine__) = (dev_priv__)->engine[__mask_next_bit(tmp__)]), 1 : 0; )

It has no mercy!
-Chris
diff mbox

Patch

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; )
 
 enum hdmi_force_audio {
 	HDMI_AUDIO_OFF_DVI = -2,	/* no aux data for HDMI-DVI converter */