Re: [PATCH 2/2] tracing/events: simplify system_enable_read()
From: Ingo Molnar
Date: Mon May 11 2009 - 08:42:13 EST
* Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, 08 May 2009 10:32:05 +0800
> Li Zefan <lizf@xxxxxxxxxxxxxx> wrote:
>
> > A smarter way to figure out the output of an enable file.
> >
> > [ Impact: clean up ]
> >
> > Signed-off-by: Li Zefan <lizf@xxxxxxxxxxxxxx>
> > ---
> > 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/