From: Daniel Vetter <daniel@ffwll.ch>
To: Dave Gordon <david.s.gordon@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>,
intel-gfx@lists.freedesktop.org,
Ben Widawsky <benjamin.widawsky@intel.com>
Subject: Re: [PATCH v1 1/2] drm/i915: Contain the WA_REG macro
Date: Fri, 14 Aug 2015 10:51:21 +0200 [thread overview]
Message-ID: <20150814085121.GO17734@phenom.ffwll.local> (raw)
In-Reply-To: <55CB68D3.9060105@intel.com>
On Wed, Aug 12, 2015 at 04:40:03PM +0100, Dave Gordon wrote:
> On 11/08/15 15:44, Arun Siluvery wrote:
> >From: Mika Kuoppala <mika.kuoppala@intel.com>
> >
> >Prevent leaking the if scoping by containing the WA_REG
> >macro inside its own scope.
> >
> >Reported-by: Arun Siluvery <arun.siluvery@linux.intel.com>
> >Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> >---
> > drivers/gpu/drm/i915/intel_ringbuffer.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> >index 1c14233..cf61262 100644
> >--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> >+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> >@@ -780,11 +780,11 @@ static int wa_add(struct drm_i915_private *dev_priv,
> > return 0;
> > }
> >
> >-#define WA_REG(addr, mask, val) { \
> >+#define WA_REG(addr, mask, val) do { \
> > const int r = wa_add(dev_priv, (addr), (mask), (val)); \
> > if (r) \
> > return r; \
> >- }
> >+ } while(0)
> >
> > #define WA_SET_BIT_MASKED(addr, mask) \
> > WA_REG(addr, (mask), _MASKED_BIT_ENABLE(mask))
>
> On the one hand, yes, this definitely needs the do-while wrapper.
>
> OTOH, hiding a conditional 'return' inside a macro is an abomination :( At
> least it's only local to this file ...
>
> So, on the grounds that this makes it more correct if no less ugly:
>
> Reviewed-by: Dave Gordon <david.s.gordon@intel.com>
Queued for -next, thanks for the patch. And I fixed the checkpatch ERROR,
tsk ;-)
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-08-14 8:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-11 14:44 [PATCH v1 0/2] Enable legacy behaviour for Push constants Arun Siluvery
2015-08-11 14:44 ` [PATCH v1 1/2] drm/i915: Contain the WA_REG macro Arun Siluvery
2015-08-12 15:40 ` Dave Gordon
2015-08-14 8:51 ` Daniel Vetter [this message]
2015-08-11 14:44 ` [PATCH v1 2/2] drm/i915/gen9: Disable gather at set shader bit Arun Siluvery
2015-08-12 15:41 ` Dave Gordon
2015-08-12 15:55 ` Siluvery, Arun
2015-08-14 8:54 ` Daniel Vetter
2015-08-14 21:17 ` shuang.he
2015-08-11 20:58 ` [PATCH v1 0/2] Enable legacy behaviour for Push constants Timo Aaltonen
2015-08-12 12:22 ` Siluvery, Arun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150814085121.GO17734@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=benjamin.widawsky@intel.com \
--cc=david.s.gordon@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mika.kuoppala@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox