public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ftrace: Don't convert function's local variable name in macro
@ 2009-05-27 13:36 Zhaolei
  2009-05-27 13:47 ` Frederic Weisbecker
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Zhaolei @ 2009-05-27 13:36 UTC (permalink / raw)
  To: Ingo Molnar, Frederic Weisbecker, Steven Rostedt; +Cc: LKML

"call" is a argument of macro, but it is also used as a local variable name of
function in macro.
We should keep this local variable name static although it haven't cause
problem now.

[ Impact: cleanup, no functionality changed ]

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 include/trace/ftrace.h |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index edb02bc..6f1218e 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -375,19 +375,19 @@ static void ftrace_profile_##call(proto)				\
 	perf_tpcounter_event(event_##call.id);				\
 }									\
 									\
-static int ftrace_profile_enable_##call(struct ftrace_event_call *call) \
+static int ftrace_profile_enable_##call(struct ftrace_event_call *event_call) \
 {									\
 	int ret = 0;							\
 									\
-	if (!atomic_inc_return(&call->profile_count))			\
+	if (!atomic_inc_return(&event_call->profile_count))		\
 		ret = register_trace_##call(ftrace_profile_##call);	\
 									\
 	return ret;							\
 }									\
 									\
-static void ftrace_profile_disable_##call(struct ftrace_event_call *call) \
+static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\
 {									\
-	if (atomic_add_negative(-1, &call->profile_count))		\
+	if (atomic_add_negative(-1, &event_call->profile_count))	\
 		unregister_trace_##call(ftrace_profile_##call);		\
 }
 
@@ -411,9 +411,9 @@ static void ftrace_profile_disable_##call(struct ftrace_event_call *call) \
 #define __array(type, item, len)
 
 #undef __string
-#define __string(item, src)						       \
-	__str_offsets.item = __str_size +				       \
-			     offsetof(typeof(*entry), __str_data);	       \
+#define __string(item, src)						\
+	__str_offsets.item = __str_size +				\
+			     offsetof(typeof(*entry), __str_data);	\
 	__str_size += strlen(src) + 1;
 
 #undef __assign_str
@@ -429,8 +429,8 @@ static struct ftrace_event_call event_##call;				\
 									\
 static void ftrace_raw_event_##call(proto)				\
 {									\
-	struct ftrace_str_offsets_##call __maybe_unused __str_offsets;  \
-	struct ftrace_event_call *call = &event_##call;			\
+	struct ftrace_str_offsets_##call __maybe_unused __str_offsets;	\
+	struct ftrace_event_call *event_call = &event_##call;		\
 	struct ring_buffer_event *event;				\
 	struct ftrace_raw_##call *entry;				\
 	unsigned long irq_flags;					\
@@ -451,7 +451,7 @@ static void ftrace_raw_event_##call(proto)				\
 									\
 	assign;								\
 									\
-	if (!filter_current_check_discard(call, entry, event))		\
+	if (!filter_current_check_discard(event_call, entry, event))	\
 		trace_nowake_buffer_unlock_commit(event, irq_flags, pc); \
 }									\
 									\
-- 
1.5.5.3



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ftrace: Don't convert function's local variable name in macro
  2009-05-27 13:36 [PATCH] ftrace: Don't convert function's local variable name in macro Zhaolei
@ 2009-05-27 13:47 ` Frederic Weisbecker
  2009-05-27 18:12 ` Steven Rostedt
  2009-05-27 23:05 ` Frederic Weisbecker
  2 siblings, 0 replies; 6+ messages in thread
From: Frederic Weisbecker @ 2009-05-27 13:47 UTC (permalink / raw)
  To: Zhaolei; +Cc: Ingo Molnar, Steven Rostedt, LKML

On Wed, May 27, 2009 at 09:36:02PM +0800, Zhaolei wrote:
> "call" is a argument of macro, but it is also used as a local variable name of
> function in macro.
> We should keep this local variable name static although it haven't cause
> problem now.
> 
> [ Impact: cleanup, no functionality changed ]
> 
> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>


Indeed, that can prevent unexpected things in the future.

Acked-by: Frederic Weisbecker <fweisbec@gmail.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ftrace: Don't convert function's local variable name in macro
  2009-05-27 13:36 [PATCH] ftrace: Don't convert function's local variable name in macro Zhaolei
  2009-05-27 13:47 ` Frederic Weisbecker
@ 2009-05-27 18:12 ` Steven Rostedt
  2009-05-27 23:05 ` Frederic Weisbecker
  2 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2009-05-27 18:12 UTC (permalink / raw)
  To: Zhaolei; +Cc: Ingo Molnar, Frederic Weisbecker, LKML



On Wed, 27 May 2009, Zhaolei wrote:

> "call" is a argument of macro, but it is also used as a local variable name of
> function in macro.
> We should keep this local variable name static although it haven't cause
> problem now.
> 
> [ Impact: cleanup, no functionality changed ]
> 
> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

> ---
>  include/trace/ftrace.h |   20 ++++++++++----------
>  1 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
> index edb02bc..6f1218e 100644
> --- a/include/trace/ftrace.h
> +++ b/include/trace/ftrace.h
> @@ -375,19 +375,19 @@ static void ftrace_profile_##call(proto)				\
>  	perf_tpcounter_event(event_##call.id);				\
>  }									\
>  									\
> -static int ftrace_profile_enable_##call(struct ftrace_event_call *call) \
> +static int ftrace_profile_enable_##call(struct ftrace_event_call *event_call) \
>  {									\
>  	int ret = 0;							\
>  									\
> -	if (!atomic_inc_return(&call->profile_count))			\
> +	if (!atomic_inc_return(&event_call->profile_count))		\
>  		ret = register_trace_##call(ftrace_profile_##call);	\
>  									\
>  	return ret;							\
>  }									\
>  									\
> -static void ftrace_profile_disable_##call(struct ftrace_event_call *call) \
> +static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\
>  {									\
> -	if (atomic_add_negative(-1, &call->profile_count))		\
> +	if (atomic_add_negative(-1, &event_call->profile_count))	\
>  		unregister_trace_##call(ftrace_profile_##call);		\
>  }
>  
> @@ -411,9 +411,9 @@ static void ftrace_profile_disable_##call(struct ftrace_event_call *call) \
>  #define __array(type, item, len)
>  
>  #undef __string
> -#define __string(item, src)						       \
> -	__str_offsets.item = __str_size +				       \
> -			     offsetof(typeof(*entry), __str_data);	       \
> +#define __string(item, src)						\
> +	__str_offsets.item = __str_size +				\
> +			     offsetof(typeof(*entry), __str_data);	\
>  	__str_size += strlen(src) + 1;
>  
>  #undef __assign_str
> @@ -429,8 +429,8 @@ static struct ftrace_event_call event_##call;				\
>  									\
>  static void ftrace_raw_event_##call(proto)				\
>  {									\
> -	struct ftrace_str_offsets_##call __maybe_unused __str_offsets;  \
> -	struct ftrace_event_call *call = &event_##call;			\
> +	struct ftrace_str_offsets_##call __maybe_unused __str_offsets;	\
> +	struct ftrace_event_call *event_call = &event_##call;		\
>  	struct ring_buffer_event *event;				\
>  	struct ftrace_raw_##call *entry;				\
>  	unsigned long irq_flags;					\
> @@ -451,7 +451,7 @@ static void ftrace_raw_event_##call(proto)				\
>  									\
>  	assign;								\
>  									\
> -	if (!filter_current_check_discard(call, entry, event))		\
> +	if (!filter_current_check_discard(event_call, entry, event))	\
>  		trace_nowake_buffer_unlock_commit(event, irq_flags, pc); \
>  }									\
>  									\
> -- 
> 1.5.5.3
> 
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ftrace: Don't convert function's local variable name in macro
  2009-05-27 13:36 [PATCH] ftrace: Don't convert function's local variable name in macro Zhaolei
  2009-05-27 13:47 ` Frederic Weisbecker
  2009-05-27 18:12 ` Steven Rostedt
@ 2009-05-27 23:05 ` Frederic Weisbecker
  2009-05-27 23:14   ` Ingo Molnar
  2 siblings, 1 reply; 6+ messages in thread
From: Frederic Weisbecker @ 2009-05-27 23:05 UTC (permalink / raw)
  To: Zhaolei; +Cc: Ingo Molnar, Steven Rostedt, LKML

On Wed, May 27, 2009 at 09:36:02PM +0800, Zhaolei wrote:
> "call" is a argument of macro, but it is also used as a local variable name of
> function in macro.
> We should keep this local variable name static although it haven't cause
> problem now.
> 
> [ Impact: cleanup, no functionality changed ]


I'm applying it.

Note, I'm also changing the impact line. This is more than a
cleanup, it's a real fix to prevent from possible CPP side effects.

So I'll put instead:

[ Impact: prevent from accidental CPP substitution ]

Thanks.



> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
> ---
>  include/trace/ftrace.h |   20 ++++++++++----------
>  1 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
> index edb02bc..6f1218e 100644
> --- a/include/trace/ftrace.h
> +++ b/include/trace/ftrace.h
> @@ -375,19 +375,19 @@ static void ftrace_profile_##call(proto)				\
>  	perf_tpcounter_event(event_##call.id);				\
>  }									\
>  									\
> -static int ftrace_profile_enable_##call(struct ftrace_event_call *call) \
> +static int ftrace_profile_enable_##call(struct ftrace_event_call *event_call) \
>  {									\
>  	int ret = 0;							\
>  									\
> -	if (!atomic_inc_return(&call->profile_count))			\
> +	if (!atomic_inc_return(&event_call->profile_count))		\
>  		ret = register_trace_##call(ftrace_profile_##call);	\
>  									\
>  	return ret;							\
>  }									\
>  									\
> -static void ftrace_profile_disable_##call(struct ftrace_event_call *call) \
> +static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\
>  {									\
> -	if (atomic_add_negative(-1, &call->profile_count))		\
> +	if (atomic_add_negative(-1, &event_call->profile_count))	\
>  		unregister_trace_##call(ftrace_profile_##call);		\
>  }
>  
> @@ -411,9 +411,9 @@ static void ftrace_profile_disable_##call(struct ftrace_event_call *call) \
>  #define __array(type, item, len)
>  
>  #undef __string
> -#define __string(item, src)						       \
> -	__str_offsets.item = __str_size +				       \
> -			     offsetof(typeof(*entry), __str_data);	       \
> +#define __string(item, src)						\
> +	__str_offsets.item = __str_size +				\
> +			     offsetof(typeof(*entry), __str_data);	\
>  	__str_size += strlen(src) + 1;
>  
>  #undef __assign_str
> @@ -429,8 +429,8 @@ static struct ftrace_event_call event_##call;				\
>  									\
>  static void ftrace_raw_event_##call(proto)				\
>  {									\
> -	struct ftrace_str_offsets_##call __maybe_unused __str_offsets;  \
> -	struct ftrace_event_call *call = &event_##call;			\
> +	struct ftrace_str_offsets_##call __maybe_unused __str_offsets;	\
> +	struct ftrace_event_call *event_call = &event_##call;		\
>  	struct ring_buffer_event *event;				\
>  	struct ftrace_raw_##call *entry;				\
>  	unsigned long irq_flags;					\
> @@ -451,7 +451,7 @@ static void ftrace_raw_event_##call(proto)				\
>  									\
>  	assign;								\
>  									\
> -	if (!filter_current_check_discard(call, entry, event))		\
> +	if (!filter_current_check_discard(event_call, entry, event))	\
>  		trace_nowake_buffer_unlock_commit(event, irq_flags, pc); \
>  }									\
>  									\
> -- 
> 1.5.5.3
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ftrace: Don't convert function's local variable name in macro
  2009-05-27 23:05 ` Frederic Weisbecker
@ 2009-05-27 23:14   ` Ingo Molnar
  2009-05-27 23:16     ` Frederic Weisbecker
  0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2009-05-27 23:14 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: Zhaolei, Steven Rostedt, LKML


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> On Wed, May 27, 2009 at 09:36:02PM +0800, Zhaolei wrote:
> > "call" is a argument of macro, but it is also used as a local variable name of
> > function in macro.
> > We should keep this local variable name static although it haven't cause
> > problem now.
> > 
> > [ Impact: cleanup, no functionality changed ]
> 
> 
> I'm applying it.
> 
> Note, I'm also changing the impact line. This is more than a
> cleanup, it's a real fix to prevent from possible CPP side effects.
> 
> So I'll put instead:
> 
> [ Impact: prevent from accidental CPP substitution ]

I suspect it should be something like:

  [ Impact: robustify macro ]

or so.

	Ingo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ftrace: Don't convert function's local variable name in macro
  2009-05-27 23:14   ` Ingo Molnar
@ 2009-05-27 23:16     ` Frederic Weisbecker
  0 siblings, 0 replies; 6+ messages in thread
From: Frederic Weisbecker @ 2009-05-27 23:16 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Zhaolei, Steven Rostedt, LKML

On Thu, May 28, 2009 at 01:14:35AM +0200, Ingo Molnar wrote:
> 
> * Frederic Weisbecker <fweisbec@gmail.com> wrote:
> 
> > On Wed, May 27, 2009 at 09:36:02PM +0800, Zhaolei wrote:
> > > "call" is a argument of macro, but it is also used as a local variable name of
> > > function in macro.
> > > We should keep this local variable name static although it haven't cause
> > > problem now.
> > > 
> > > [ Impact: cleanup, no functionality changed ]
> > 
> > 
> > I'm applying it.
> > 
> > Note, I'm also changing the impact line. This is more than a
> > cleanup, it's a real fix to prevent from possible CPP side effects.
> > 
> > So I'll put instead:
> > 
> > [ Impact: prevent from accidental CPP substitution ]
> 
> I suspect it should be something like:
> 
>   [ Impact: robustify macro ]


Ok, I take this one!

Thanks.

 
> or so.
> 
> 	Ingo


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-05-27 23:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-27 13:36 [PATCH] ftrace: Don't convert function's local variable name in macro Zhaolei
2009-05-27 13:47 ` Frederic Weisbecker
2009-05-27 18:12 ` Steven Rostedt
2009-05-27 23:05 ` Frederic Weisbecker
2009-05-27 23:14   ` Ingo Molnar
2009-05-27 23:16     ` Frederic Weisbecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox