Skip to contentSkip to conversation

ftrace: set direct_ops storage-class-specifier to static

PATCH In review Tom Rix 4 participants 5 messages Mar 11, 2023 – Mar 21, 2023

Subsystems (2)
lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 ftrace: set direct_ops storage-class-specifier to static

smatch reports this warning kernel/trace/ftrace.c:2594:19: warning:
symbol 'direct_ops' was not declared. Should it be static?

The variable direct_ops is only used in ftrace.c, so it should be static

---
 kernel/trace/ftrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/ftrace.c +1 -1
index 29baa97d0d53..05f76dc1f0c5 100644
@@ -2591,7 +2591,7 @@ static void call_direct_funcs(unsigned long ip, unsigned long pip,
 	arch_ftrace_set_direct_caller(fregs, addr);
 }
 
-struct ftrace_ops direct_ops = {
+static struct ftrace_ops direct_ops = {
 	.func		= call_direct_funcs,
 	.flags		= FTRACE_OPS_FL_DIRECT | FTRACE_OPS_FL_SAVE_REGS
 			  | FTRACE_OPS_FL_PERMANENT,
Signature · 1 line
2.27.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Sat, 11 Mar 2023 08:51:13 -0500 Tom Rix <[email protected]> wrote:

smatch reports this warning kernel/trace/ftrace.c:2594:19: warning:
symbol 'direct_ops' was not declared. Should it be static?

The variable direct_ops is only used in ftrace.c, so it should be static

This looks good to me.

Thank you!

Quoted 20 lines
---
 kernel/trace/ftrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/ftrace.c +1 -1
index 29baa97d0d53..05f76dc1f0c5 100644
@@ -2591,7 +2591,7 @@ static void call_direct_funcs(unsigned long ip, unsigned long pip,
 	arch_ftrace_set_direct_caller(fregs, addr);
 }
 
-struct ftrace_ops direct_ops = {
+static struct ftrace_ops direct_ops = {
 	.func		= call_direct_funcs,
 	.flags		= FTRACE_OPS_FL_DIRECT | FTRACE_OPS_FL_SAVE_REGS
 			  | FTRACE_OPS_FL_PERMANENT,
Signature · 1 line
2.27.0
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
reviewer Acked-by on v1 1/1
#2 lore raw
In reply to Tom Rix
Quoted 7 lines · Tom Rix

smatch reports this warning kernel/trace/ftrace.c:2594:19: warning:
symbol 'direct_ops' was not declared. Should it be static?

The variable direct_ops is only used in ftrace.c, so it should be static

This makes sense, and as this stands:

... but Florent's rework of the API is going to remove this anyway:

https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/

... so if we take Florent's series, this patch isn't necessary.

Mark.

Quoted 20 lines
---
 kernel/trace/ftrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/ftrace.c +1 -1
index 29baa97d0d53..05f76dc1f0c5 100644
@@ -2591,7 +2591,7 @@ static void call_direct_funcs(unsigned long ip, unsigned long pip,
 	arch_ftrace_set_direct_caller(fregs, addr);
 }
 
-struct ftrace_ops direct_ops = {
+static struct ftrace_ops direct_ops = {
 	.func		= call_direct_funcs,
 	.flags		= FTRACE_OPS_FL_DIRECT | FTRACE_OPS_FL_SAVE_REGS
 			  | FTRACE_OPS_FL_PERMANENT,
Signature · 1 line
2.27.0
maintainer
#3 lore raw
Quoted 11 lines · On Mon, 20 Mar 2023 17:44:13 +0000 Mark Rutland <[email protected]> wrote:
Quoted 7 lines · Tom Rix

smatch reports this warning kernel/trace/ftrace.c:2594:19: warning:
symbol 'direct_ops' was not declared. Should it be static?

The variable direct_ops is only used in ftrace.c, so it should be static

This makes sense, and as this stands:

Quoted 8 lines

... but Florent's rework of the API is going to remove this anyway:

https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/

... so if we take Florent's series, this patch isn't necessary.

Except that it's already upstream:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8732565549011cabbea08329a1aefd78a68d96c7

I had to rebase Florent's patch to accommodate this change.

-- Steve

reviewer
#4 lore raw
Quoted 20 lines · Steven Rostedt
Quoted 18 lines · On Mon, 20 Mar 2023 17:44:13 +0000 Mark Rutland <[email protected]> wrote:
Quoted 7 lines · Tom Rix

smatch reports this warning kernel/trace/ftrace.c:2594:19: warning:
symbol 'direct_ops' was not declared. Should it be static?

The variable direct_ops is only used in ftrace.c, so it should be static

This makes sense, and as this stands:

... but Florent's rework of the API is going to remove this anyway:

https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/

Quoted 7 lines
Quoted 1 line

... so if we take Florent's series, this patch isn't necessary.

Except that it's already upstream:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8732565549011cabbea08329a1aefd78a68d96c7

I had to rebase Florent's patch to accommodate this change.

Sorry for the noise; my fault for being so far behind with patch review!

Mark.