From: David Woodhouse <dwmw2@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: intel-iommu: Add for_each_iommu() and for_each_active_iommu() macros
Date: Mon, 06 Apr 2009 18:19:06 -0700 [thread overview]
Message-ID: <1239067146.22733.260.camel@macbook.infradead.org> (raw)
In-Reply-To: <1239066583.22733.258.camel@macbook.infradead.org>
On Mon, 2009-04-06 at 18:09 -0700, David Woodhouse wrote:
>
> I'm unconvinced by the fix -- can we find a way to fix the if() macro so
> that normal (if fugly) C code like this doesn't doesn't need this kind
> of workaround?
Something like this perhaps? I'd reformat it but dinner calls...
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 6faa7e5..1da2e72 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -114,7 +114,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
* "Define 'is'", Bill Clinton
* "Define 'if'", Steven Rostedt
*/
-#define if(cond) if (__builtin_constant_p((cond)) ? !!(cond) : \
+#define if(cond, ...) if (__builtin_constant_p((cond, ## __VA_ARGS__)) ? !!(cond, ## __VA_ARGS__) : \
({ \
int ______r; \
static struct ftrace_branch_data \
@@ -125,7 +125,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
.file = __FILE__, \
.line = __LINE__, \
}; \
- ______r = !!(cond); \
+ ______r = !!(cond, ## __VA_ARGS__); \
______f.miss_hit[______r]++; \
______r; \
}))
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
next prev parent reply other threads:[~2009-04-07 1:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200904062159.n36Lx1OJ001967@hera.kernel.org>
2009-04-07 0:59 ` intel-iommu: Add for_each_iommu() and for_each_active_iommu() macros Andrew Morton
2009-04-07 1:09 ` David Woodhouse
2009-04-07 1:19 ` David Woodhouse [this message]
2009-04-07 1:24 ` Andrew Morton
2009-04-07 1:29 ` Steven Rostedt
2009-04-07 2:58 ` David Woodhouse
2009-04-07 3:02 ` Steven Rostedt
2009-04-07 3:29 ` David Woodhouse
2009-04-08 11:00 ` Ingo Molnar
2009-04-09 0:42 ` David Woodhouse
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=1239067146.22733.260.camel@macbook.infradead.org \
--to=dwmw2@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.