[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090508155207.50727920.akpm@linux-foundation.org>
Date: Fri, 8 May 2009 15:52:07 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Li Zefan <lizf@...fujitsu.com>
Cc: mingo@...e.hu, rostedt@...dmis.org, fweisbec@...il.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] tracing/events: simplify system_enable_read()
On Fri, 08 May 2009 10:32:05 +0800
Li Zefan <lizf@...fujitsu.com> wrote:
> A smarter way to figure out the output of an enable file.
>
> [ Impact: clean up ]
>
> Signed-off-by: Li Zefan <lizf@...fujitsu.com>
> ---
> kernel/trace/trace_events.c | 40 ++++++----------------------------------
> 1 files changed, 6 insertions(+), 34 deletions(-)
>
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 45f1099..df394bc 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -414,10 +414,11 @@ static ssize_t
> system_enable_read(struct file *filp, char __user *ubuf, size_t cnt,
> loff_t *ppos)
> {
> + const char set_to_char[4] = { '?', '0', '1', 'X' };
I always worry when I see this, but gcc does manage to add the missing
`static' all by itself. For which versions of gcc that is true I don't
know.
> + buf[0] = set_to_char[set];
Meh. Real men do
buf[0] = "?01X"[set];
--
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