mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tracing: Simplify conditional compilation code in tracing_set_tracer()
@ 2022-06-02  2:24 sunliming
  2022-06-02 12:25 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: sunliming @ 2022-06-02  2:24 UTC (permalink / raw)
  To: rostedt, mingo; +Cc: linux-kernel, sunliming, kelulanainsley

Two conditional compilation directives "#ifdef CONFIG_TRACER_SNAPSHOT"
are used consecutively, and no other code in between. Simplify conditional
the compilation code and only use one "#ifdef CONFIG_TRACER_SNAPSHOT".

Signed-off-by: sunliming <sunliming@kylinos.cn>
---
 kernel/trace/trace.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index f400800bc910..dc959e339512 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -6430,9 +6430,7 @@ int tracing_set_tracer(struct trace_array *tr, const char *buf)
 		synchronize_rcu();
 		free_snapshot(tr);
 	}
-#endif
 
-#ifdef CONFIG_TRACER_MAX_TRACE
 	if (t->use_max_tr && !had_max_tr) {
 		ret = tracing_alloc_snapshot_instance(tr);
 		if (ret < 0)
-- 
2.25.1


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

* Re: [PATCH] tracing: Simplify conditional compilation code in tracing_set_tracer()
  2022-06-02  2:24 [PATCH] tracing: Simplify conditional compilation code in tracing_set_tracer() sunliming
@ 2022-06-02 12:25 ` Steven Rostedt
  2022-06-02 13:54   ` sunliming
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2022-06-02 12:25 UTC (permalink / raw)
  To: sunliming; +Cc: mingo, linux-kernel, kelulanainsley

On Thu,  2 Jun 2022 10:24:04 +0800
sunliming <sunliming@kylinos.cn> wrote:

> Two conditional compilation directives "#ifdef CONFIG_TRACER_SNAPSHOT"
> are used consecutively, and no other code in between. Simplify conditional
> the compilation code and only use one "#ifdef CONFIG_TRACER_SNAPSHOT".

I think you mean CONFIG_TRACER_MAX_TRACE here.

-- Steve

> 
> Signed-off-by: sunliming <sunliming@kylinos.cn>
> ---
>  kernel/trace/trace.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index f400800bc910..dc959e339512 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -6430,9 +6430,7 @@ int tracing_set_tracer(struct trace_array *tr, const char *buf)
>  		synchronize_rcu();
>  		free_snapshot(tr);
>  	}
> -#endif
>  
> -#ifdef CONFIG_TRACER_MAX_TRACE
>  	if (t->use_max_tr && !had_max_tr) {
>  		ret = tracing_alloc_snapshot_instance(tr);
>  		if (ret < 0)


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

* Re: [PATCH] tracing: Simplify conditional compilation code in tracing_set_tracer()
  2022-06-02 12:25 ` Steven Rostedt
@ 2022-06-02 13:54   ` sunliming
  0 siblings, 0 replies; 3+ messages in thread
From: sunliming @ 2022-06-02 13:54 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: mingo, linux-kernel

Steven Rostedt <rostedt@goodmis.org> 于2022年6月2日周四 20:26写道:
>
> On Thu,  2 Jun 2022 10:24:04 +0800
> sunliming <sunliming@kylinos.cn> wrote:
>
> > Two conditional compilation directives "#ifdef CONFIG_TRACER_SNAPSHOT"
> > are used consecutively, and no other code in between. Simplify conditional
> > the compilation code and only use one "#ifdef CONFIG_TRACER_SNAPSHOT".
>
> I think you mean CONFIG_TRACER_MAX_TRACE here.
>
> -- Steve
>
> >
> > Signed-off-by: sunliming <sunliming@kylinos.cn>
> > ---
> >  kernel/trace/trace.c | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> > index f400800bc910..dc959e339512 100644
> > --- a/kernel/trace/trace.c
> > +++ b/kernel/trace/trace.c
> > @@ -6430,9 +6430,7 @@ int tracing_set_tracer(struct trace_array *tr, const char *buf)
> >               synchronize_rcu();
> >               free_snapshot(tr);
> >       }
> > -#endif
> >
> > -#ifdef CONFIG_TRACER_MAX_TRACE
> >       if (t->use_max_tr && !had_max_tr) {
> >               ret = tracing_alloc_snapshot_instance(tr);
> >               if (ret < 0)
>
Yes, you are right. I am sorry about this low-level mistakes.

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

end of thread, other threads:[~2022-06-02 13:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02  2:24 [PATCH] tracing: Simplify conditional compilation code in tracing_set_tracer() sunliming
2022-06-02 12:25 ` Steven Rostedt
2022-06-02 13:54   ` sunliming

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

all inboxes | Powered by JetHome®