lkml.org 
[lkml]   [2009]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 2/2] tracing/events: simplify system_enable_read()

    * Andrew Morton <akpm@linux-foundation.org> wrote:

    > On Fri, 08 May 2009 10:32:05 +0800
    > Li Zefan <lizf@cn.fujitsu.com> wrote:
    >
    > > A smarter way to figure out the output of an enable file.
    > >
    > > [ Impact: clean up ]
    > >
    > > Signed-off-by: Li Zefan <lizf@cn.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


    \
     
     \ /
      Last update: 2009-05-11 14:45    [W:0.032 / U:31.320 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site