All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: mingo@elte.hu, rostedt@goodmis.org, fweisbec@gmail.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] tracing/events: simplify system_enable_read()
Date: Fri, 8 May 2009 15:52:07 -0700	[thread overview]
Message-ID: <20090508155207.50727920.akpm@linux-foundation.org> (raw)
In-Reply-To: <4A0399A5.2080603@cn.fujitsu.com>

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];


  parent reply	other threads:[~2009-05-08 22:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-08  2:31 [PATCH 1/2] tracing/events: clean up for ftrace_set_clr_event() Li Zefan
2009-05-08  2:32 ` [PATCH 2/2] tracing/events: simplify system_enable_read() Li Zefan
2009-05-08  2:44   ` Steven Rostedt
2009-05-08 11:03   ` Frederic Weisbecker
2009-05-08 18:27   ` [tip:tracing/core] " tip-bot for Li Zefan
2009-05-08 22:52   ` Andrew Morton [this message]
2009-05-11 12:40     ` [PATCH 2/2] " Ingo Molnar
2009-05-08  2:52 ` [PATCH 1/2] tracing/events: clean up for ftrace_set_clr_event() Steven Rostedt
2009-05-08  3:03   ` Li Zefan
2009-05-08 10:50 ` Frederic Weisbecker
2009-05-08 11:16   ` Li Zefan
2009-05-08 11:27     ` Frederic Weisbecker
2009-05-08 12:05       ` Ingo Molnar
2009-05-08 12:01     ` Steven Rostedt
2009-05-08 11:35   ` Steven Rostedt
2009-05-08 11:47     ` Frederic Weisbecker
2009-05-08 18:27 ` [tip:tracing/core] " tip-bot for Li Zefan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090508155207.50727920.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.