All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing: Fix warning on variable 'struct trace_array'
@ 2022-11-07 16:05 Aashish Sharma
  2022-11-07 17:17 ` Guenter Roeck
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Aashish Sharma @ 2022-11-07 16:05 UTC (permalink / raw)
  To: Steven Rostedt, Masami Hiramatsu, Martin K. Petersen
  Cc: Arun Easi, linux-kernel, Aashish Sharma

Move the declaration of 'struct trace_array' out of #ifdef
CONFIG_TRACING block, to fix the following warning when CONFIG_TRACING
is not set:

>> include/linux/trace.h:63:45: warning: 'struct trace_array' declared
inside parameter list will not be visible outside of this definition or
declaration

Fixes: 1a77dd1c2bb5 ("scsi: tracing: Fix compile error in trace_array calls when TRACING is disabled")
Cc: Arun Easi <aeasi@marvell.com>
Signed-off-by: Aashish Sharma <shraash@google.com>
---
 include/linux/trace.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/trace.h b/include/linux/trace.h
index b5e16e438448..80ffda871749 100644
--- a/include/linux/trace.h
+++ b/include/linux/trace.h
@@ -26,13 +26,13 @@ struct trace_export {
 	int flags;
 };
 
+struct trace_array;
+
 #ifdef CONFIG_TRACING
 
 int register_ftrace_export(struct trace_export *export);
 int unregister_ftrace_export(struct trace_export *export);
 
-struct trace_array;
-
 void trace_printk_init_buffers(void);
 __printf(3, 4)
 int trace_array_printk(struct trace_array *tr, unsigned long ip,
-- 
2.38.1.431.g37b22c650d-goog


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

* Re: [PATCH] tracing: Fix warning on variable 'struct trace_array'
  2022-11-07 16:05 [PATCH] tracing: Fix warning on variable 'struct trace_array' Aashish Sharma
@ 2022-11-07 17:17 ` Guenter Roeck
  2022-11-11 12:48 ` Masami Hiramatsu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2022-11-07 17:17 UTC (permalink / raw)
  To: Aashish Sharma
  Cc: Steven Rostedt, Masami Hiramatsu, Martin K. Petersen, Arun Easi,
	linux-kernel

On Mon, Nov 07, 2022 at 09:35:56PM +0530, Aashish Sharma wrote:
> Move the declaration of 'struct trace_array' out of #ifdef
> CONFIG_TRACING block, to fix the following warning when CONFIG_TRACING
> is not set:
> 
> >> include/linux/trace.h:63:45: warning: 'struct trace_array' declared
> inside parameter list will not be visible outside of this definition or
> declaration
> 
> Fixes: 1a77dd1c2bb5 ("scsi: tracing: Fix compile error in trace_array calls when TRACING is disabled")
> Cc: Arun Easi <aeasi@marvell.com>
> Signed-off-by: Aashish Sharma <shraash@google.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  include/linux/trace.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/trace.h b/include/linux/trace.h
> index b5e16e438448..80ffda871749 100644
> --- a/include/linux/trace.h
> +++ b/include/linux/trace.h
> @@ -26,13 +26,13 @@ struct trace_export {
>  	int flags;
>  };
>  
> +struct trace_array;
> +
>  #ifdef CONFIG_TRACING
>  
>  int register_ftrace_export(struct trace_export *export);
>  int unregister_ftrace_export(struct trace_export *export);
>  
> -struct trace_array;
> -
>  void trace_printk_init_buffers(void);
>  __printf(3, 4)
>  int trace_array_printk(struct trace_array *tr, unsigned long ip,
> -- 
> 2.38.1.431.g37b22c650d-goog
> 

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

* Re: [PATCH] tracing: Fix warning on variable 'struct trace_array'
  2022-11-07 16:05 [PATCH] tracing: Fix warning on variable 'struct trace_array' Aashish Sharma
  2022-11-07 17:17 ` Guenter Roeck
@ 2022-11-11 12:48 ` Masami Hiramatsu
  2022-11-16  0:16 ` [EXT] " Arun Easi
  2022-11-17  2:53 ` Steven Rostedt
  3 siblings, 0 replies; 5+ messages in thread
From: Masami Hiramatsu @ 2022-11-11 12:48 UTC (permalink / raw)
  To: Aashish Sharma
  Cc: Steven Rostedt, Martin K. Petersen, Arun Easi, linux-kernel,
	Linux Trace Kernel

On Mon,  7 Nov 2022 21:35:56 +0530
Aashish Sharma <shraash@google.com> wrote:

> Move the declaration of 'struct trace_array' out of #ifdef
> CONFIG_TRACING block, to fix the following warning when CONFIG_TRACING
> is not set:
> 
> >> include/linux/trace.h:63:45: warning: 'struct trace_array' declared
> inside parameter list will not be visible outside of this definition or
> declaration
> 

This looks good to me.

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Thank you!

> Fixes: 1a77dd1c2bb5 ("scsi: tracing: Fix compile error in trace_array calls when TRACING is disabled")
> Cc: Arun Easi <aeasi@marvell.com>
> Signed-off-by: Aashish Sharma <shraash@google.com>
> ---
>  include/linux/trace.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/trace.h b/include/linux/trace.h
> index b5e16e438448..80ffda871749 100644
> --- a/include/linux/trace.h
> +++ b/include/linux/trace.h
> @@ -26,13 +26,13 @@ struct trace_export {
>  	int flags;
>  };
>  
> +struct trace_array;
> +
>  #ifdef CONFIG_TRACING
>  
>  int register_ftrace_export(struct trace_export *export);
>  int unregister_ftrace_export(struct trace_export *export);
>  
> -struct trace_array;
> -
>  void trace_printk_init_buffers(void);
>  __printf(3, 4)
>  int trace_array_printk(struct trace_array *tr, unsigned long ip,
> -- 
> 2.38.1.431.g37b22c650d-goog
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

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

* Re: [EXT] [PATCH] tracing: Fix warning on variable 'struct trace_array'
  2022-11-07 16:05 [PATCH] tracing: Fix warning on variable 'struct trace_array' Aashish Sharma
  2022-11-07 17:17 ` Guenter Roeck
  2022-11-11 12:48 ` Masami Hiramatsu
@ 2022-11-16  0:16 ` Arun Easi
  2022-11-17  2:53 ` Steven Rostedt
  3 siblings, 0 replies; 5+ messages in thread
From: Arun Easi @ 2022-11-16  0:16 UTC (permalink / raw)
  To: Aashish Sharma
  Cc: Steven Rostedt, Masami Hiramatsu, Martin K. Petersen, linux-kernel

On Mon, 7 Nov 2022, 8:05am, Aashish Sharma wrote:

>
> ----------------------------------------------------------------------
> Move the declaration of 'struct trace_array' out of #ifdef
> CONFIG_TRACING block, to fix the following warning when CONFIG_TRACING
> is not set:
> 
> >> include/linux/trace.h:63:45: warning: 'struct trace_array' declared
> inside parameter list will not be visible outside of this definition or
> declaration
> 
> Fixes: 1a77dd1c2bb5 ("scsi: tracing: Fix compile error in trace_array calls when TRACING is disabled")
> Cc: Arun Easi <aeasi@marvell.com>
> Signed-off-by: Aashish Sharma <shraash@google.com>
> ---
>  include/linux/trace.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/trace.h b/include/linux/trace.h
> index b5e16e438448..80ffda871749 100644
> --- a/include/linux/trace.h
> +++ b/include/linux/trace.h
> @@ -26,13 +26,13 @@ struct trace_export {
>  	int flags;
>  };
>  
> +struct trace_array;
> +
>  #ifdef CONFIG_TRACING
>  
>  int register_ftrace_export(struct trace_export *export);
>  int unregister_ftrace_export(struct trace_export *export);
>  
> -struct trace_array;
> -
>  void trace_printk_init_buffers(void);
>  __printf(3, 4)
>  int trace_array_printk(struct trace_array *tr, unsigned long ip,
> 

Looks good. Thanks!

I was wondering why I did not see this when I compiled the kernel without 
TRACING (for 1a77dd1c2bb5). Apparently, I had linux/trace_events.h 
included, which does exactly this. Anyway, makes sense to move this 
outside the #ifdef block.

Regards,
-Arun

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

* Re: [PATCH] tracing: Fix warning on variable 'struct trace_array'
  2022-11-07 16:05 [PATCH] tracing: Fix warning on variable 'struct trace_array' Aashish Sharma
                   ` (2 preceding siblings ...)
  2022-11-16  0:16 ` [EXT] " Arun Easi
@ 2022-11-17  2:53 ` Steven Rostedt
  3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2022-11-17  2:53 UTC (permalink / raw)
  To: Aashish Sharma
  Cc: Masami Hiramatsu, Martin K. Petersen, Arun Easi, linux-kernel

On Mon,  7 Nov 2022 21:35:56 +0530
Aashish Sharma <shraash@google.com> wrote:

> Move the declaration of 'struct trace_array' out of #ifdef
> CONFIG_TRACING block, to fix the following warning when CONFIG_TRACING
> is not set:
> 
> >> include/linux/trace.h:63:45: warning: 'struct trace_array' declared  
> inside parameter list will not be visible outside of this definition or
> declaration
> 
> Fixes: 1a77dd1c2bb5 ("scsi: tracing: Fix compile error in trace_array calls when TRACING is disabled")
> Cc: Arun Easi <aeasi@marvell.com>
> Signed-off-by: Aashish Sharma <shraash@google.com>
>

Queued. Thanks Aashish!

-- Steve

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

end of thread, other threads:[~2022-11-17  2:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07 16:05 [PATCH] tracing: Fix warning on variable 'struct trace_array' Aashish Sharma
2022-11-07 17:17 ` Guenter Roeck
2022-11-11 12:48 ` Masami Hiramatsu
2022-11-16  0:16 ` [EXT] " Arun Easi
2022-11-17  2:53 ` Steven Rostedt

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.