[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090511124043.GI13954@elte.hu>
Date: Mon, 11 May 2009 14:40:43 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Li Zefan <lizf@...fujitsu.com>, rostedt@...dmis.org,
fweisbec@...il.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] tracing/events: simplify system_enable_read()
* Andrew Morton <akpm@...ux-foundation.org> wrote:
> 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];
heh. That deserves a commit ...
Ingo
--
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