All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing/osnoise: set several trace_osnoise.c variables storage-class-specifier to static
@ 2023-03-09 15:04 Tom Rix
  2023-03-10  5:24 ` Masami Hiramatsu
  2023-03-10 13:53 ` Daniel Bristot de Oliveira
  0 siblings, 2 replies; 3+ messages in thread
From: Tom Rix @ 2023-03-09 15:04 UTC (permalink / raw)
  To: rostedt, bristot, mhiramat; +Cc: linux-kernel, linux-trace-kernel, Tom Rix

smatch reports several similar warnings
kernel/trace/trace_osnoise.c:220:1: warning:
  symbol '__pcpu_scope_per_cpu_osnoise_var' was not declared. Should it be static?
kernel/trace/trace_osnoise.c:243:1: warning:
  symbol '__pcpu_scope_per_cpu_timerlat_var' was not declared. Should it be static?
kernel/trace/trace_osnoise.c:335:14: warning:
  symbol 'interface_lock' was not declared. Should it be static?
kernel/trace/trace_osnoise.c:2242:5: warning:
  symbol 'timerlat_min_period' was not declared. Should it be static?
kernel/trace/trace_osnoise.c:2243:5: warning:
  symbol 'timerlat_max_period' was not declared. Should it be static?

These variables are only used in trace_osnoise.c, so it should be static

Signed-off-by: Tom Rix <trix@redhat.com>
---
 kernel/trace/trace_osnoise.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index f68ca1e6460f..cf395d2e8775 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -217,7 +217,7 @@ struct osnoise_variables {
 /*
  * Per-cpu runtime information.
  */
-DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var);
+static DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var);
 
 /*
  * this_cpu_osn_var - Return the per-cpu osnoise_variables on its relative CPU
@@ -240,7 +240,7 @@ struct timerlat_variables {
 	u64			count;
 };
 
-DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var);
+static DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var);
 
 /*
  * this_cpu_tmr_var - Return the per-cpu timerlat_variables on its relative CPU
@@ -332,7 +332,7 @@ struct timerlat_sample {
 /*
  * Protect the interface.
  */
-struct mutex interface_lock;
+static struct mutex interface_lock;
 
 /*
  * Tracer data.
@@ -2239,8 +2239,8 @@ static struct trace_min_max_param osnoise_print_stack = {
 /*
  * osnoise/timerlat_period: min 100 us, max 1 s
  */
-u64 timerlat_min_period = 100;
-u64 timerlat_max_period = 1000000;
+static u64 timerlat_min_period = 100;
+static u64 timerlat_max_period = 1000000;
 static struct trace_min_max_param timerlat_period = {
 	.lock	= &interface_lock,
 	.val	= &osnoise_data.timerlat_period,
-- 
2.27.0


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

* Re: [PATCH] tracing/osnoise: set several trace_osnoise.c variables storage-class-specifier to static
  2023-03-09 15:04 [PATCH] tracing/osnoise: set several trace_osnoise.c variables storage-class-specifier to static Tom Rix
@ 2023-03-10  5:24 ` Masami Hiramatsu
  2023-03-10 13:53 ` Daniel Bristot de Oliveira
  1 sibling, 0 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2023-03-10  5:24 UTC (permalink / raw)
  To: Tom Rix; +Cc: rostedt, bristot, linux-kernel, linux-trace-kernel

On Thu,  9 Mar 2023 10:04:14 -0500
Tom Rix <trix@redhat.com> wrote:

> smatch reports several similar warnings
> kernel/trace/trace_osnoise.c:220:1: warning:
>   symbol '__pcpu_scope_per_cpu_osnoise_var' was not declared. Should it be static?
> kernel/trace/trace_osnoise.c:243:1: warning:
>   symbol '__pcpu_scope_per_cpu_timerlat_var' was not declared. Should it be static?
> kernel/trace/trace_osnoise.c:335:14: warning:
>   symbol 'interface_lock' was not declared. Should it be static?
> kernel/trace/trace_osnoise.c:2242:5: warning:
>   symbol 'timerlat_min_period' was not declared. Should it be static?
> kernel/trace/trace_osnoise.c:2243:5: warning:
>   symbol 'timerlat_max_period' was not declared. Should it be static?
> 
> These variables are only used in trace_osnoise.c, so it should be static
> 

Looks good to me.

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

Thanks!

> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  kernel/trace/trace_osnoise.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
> index f68ca1e6460f..cf395d2e8775 100644
> --- a/kernel/trace/trace_osnoise.c
> +++ b/kernel/trace/trace_osnoise.c
> @@ -217,7 +217,7 @@ struct osnoise_variables {
>  /*
>   * Per-cpu runtime information.
>   */
> -DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var);
> +static DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var);
>  
>  /*
>   * this_cpu_osn_var - Return the per-cpu osnoise_variables on its relative CPU
> @@ -240,7 +240,7 @@ struct timerlat_variables {
>  	u64			count;
>  };
>  
> -DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var);
> +static DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var);
>  
>  /*
>   * this_cpu_tmr_var - Return the per-cpu timerlat_variables on its relative CPU
> @@ -332,7 +332,7 @@ struct timerlat_sample {
>  /*
>   * Protect the interface.
>   */
> -struct mutex interface_lock;
> +static struct mutex interface_lock;
>  
>  /*
>   * Tracer data.
> @@ -2239,8 +2239,8 @@ static struct trace_min_max_param osnoise_print_stack = {
>  /*
>   * osnoise/timerlat_period: min 100 us, max 1 s
>   */
> -u64 timerlat_min_period = 100;
> -u64 timerlat_max_period = 1000000;
> +static u64 timerlat_min_period = 100;
> +static u64 timerlat_max_period = 1000000;
>  static struct trace_min_max_param timerlat_period = {
>  	.lock	= &interface_lock,
>  	.val	= &osnoise_data.timerlat_period,
> -- 
> 2.27.0
> 


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

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

* Re: [PATCH] tracing/osnoise: set several trace_osnoise.c variables storage-class-specifier to static
  2023-03-09 15:04 [PATCH] tracing/osnoise: set several trace_osnoise.c variables storage-class-specifier to static Tom Rix
  2023-03-10  5:24 ` Masami Hiramatsu
@ 2023-03-10 13:53 ` Daniel Bristot de Oliveira
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Bristot de Oliveira @ 2023-03-10 13:53 UTC (permalink / raw)
  To: Tom Rix, rostedt, mhiramat; +Cc: linux-kernel, linux-trace-kernel

On 3/9/23 16:04, Tom Rix wrote:
> smatch reports several similar warnings
> kernel/trace/trace_osnoise.c:220:1: warning:
>   symbol '__pcpu_scope_per_cpu_osnoise_var' was not declared. Should it be static?
> kernel/trace/trace_osnoise.c:243:1: warning:
>   symbol '__pcpu_scope_per_cpu_timerlat_var' was not declared. Should it be static?
> kernel/trace/trace_osnoise.c:335:14: warning:
>   symbol 'interface_lock' was not declared. Should it be static?
> kernel/trace/trace_osnoise.c:2242:5: warning:
>   symbol 'timerlat_min_period' was not declared. Should it be static?
> kernel/trace/trace_osnoise.c:2243:5: warning:
>   symbol 'timerlat_max_period' was not declared. Should it be static?
> 
> These variables are only used in trace_osnoise.c, so it should be static
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org>

-- Daniel

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

end of thread, other threads:[~2023-03-10 13:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-09 15:04 [PATCH] tracing/osnoise: set several trace_osnoise.c variables storage-class-specifier to static Tom Rix
2023-03-10  5:24 ` Masami Hiramatsu
2023-03-10 13:53 ` Daniel Bristot de Oliveira

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.