[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0904062127420.24008@gandalf.stny.rr.com>
Date: Mon, 6 Apr 2009 21:29:16 -0400 (EDT)
From: Steven Rostedt <rostedt@...dmis.org>
To: David Woodhouse <dwmw2@...radead.org>
cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>
Subject: Re: intel-iommu: Add for_each_iommu() and for_each_active_iommu()
macros
On Mon, 6 Apr 2009, David Woodhouse wrote:
> 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...
Use emacs Ctrl-c / ;-)
>
> 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; \
> }))
>
If this works then (after reformating)
Acked-by: Steven Rostedt <rostedt@...dmis.org>
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists