Skip to contentSkip to conversation

ftrace/samples: Add missing prototype for my_direct_func

PATCH Superseded Jiri Olsa 2 participants 3 messages Nov 1, 2021 ftrace

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

PATCH 1/1 ftrace/samples: Add missing prototype for my_direct_func

There's compilation fail reported kernel test robot for W=1 build:

Quoted 1 line
Quoted 1 line

samples/ftrace/ftrace-direct-multi.c:8:6: warning: no previous

prototype for function 'my_direct_func' [-Wmissing-prototypes]
void my_direct_func(unsigned long ip)

The inlined assembly is used outside function, so we can't make my_direct_func static and pass it as asm input argument.

However my_tramp is already extern so I think there's no problem keeping my_direct_func extern as well and just add its prototype.

Fixes 5fae941b9a6f ("ftrace/samples: Add multi direct interface test module")
---
 samples/ftrace/ftrace-direct-multi.c | 1 +
 1 file changed, 1 insertion(+)
samples/ftrace/ftrace-direct-multi.c +1 -0
index 2a5b1fb7ac14..e0ccf43da0c9 100644
@@ -10,6 +10,7 @@ void my_direct_func(unsigned long ip)
 	trace_printk("ip %lx\n", ip);
 }
 
+extern void my_direct_func(unsigned long ip);
 extern void my_tramp(void *);
 
 asm (
Signature · 1 line
2.32.0
maintainer
#1 lore raw
Quoted 24 lines · On Mon, 1 Nov 2021 16:20:02 +0100 Jiri Olsa <[email protected]> wrote:

There's compilation fail reported kernel test robot for W=1 build:

Quoted 1 line
Quoted 1 line

samples/ftrace/ftrace-direct-multi.c:8:6: warning: no previous

prototype for function 'my_direct_func' [-Wmissing-prototypes]
void my_direct_func(unsigned long ip)

The inlined assembly is used outside function, so we can't make my_direct_func static and pass it as asm input argument.

However my_tramp is already extern so I think there's no problem keeping my_direct_func extern as well and just add its prototype.

Fixes 5fae941b9a6f ("ftrace/samples: Add multi direct interface test module")
---
 samples/ftrace/ftrace-direct-multi.c | 1 +
 1 file changed, 1 insertion(+)
samples/ftrace/ftrace-direct-multi.c +0 -0
index 2a5b1fb7ac14..e0ccf43da0c9 100644

samples/ftrace/ftrace-direct-multi.c void my_direct_func(unsigned long ip) · line 14

Quoted 5 lines
samples/ftrace/ftrace-direct-multi.c +1 -0
@@ -10,6 +10,7 @@ void my_direct_func(unsigned long ip)
 	trace_printk("ip %lx\n", ip);
 }
 
+extern void my_direct_func(unsigned long ip);
 extern void my_tramp(void *);

Except that I believe that the prototype must come before it is used.

I don't think this will fix the warning.

-- Steve

Quoted 2 lines
samples/ftrace/ftrace-direct-multi.c +0 -0
 asm (
author
#2 lore raw
Quoted 30 lines · Steven Rostedt
Quoted 27 lines · On Mon, 1 Nov 2021 16:20:02 +0100 Jiri Olsa <[email protected]> wrote:

There's compilation fail reported kernel test robot for W=1 build:

Quoted 1 line
Quoted 1 line

samples/ftrace/ftrace-direct-multi.c:8:6: warning: no previous

prototype for function 'my_direct_func' [-Wmissing-prototypes]
void my_direct_func(unsigned long ip)

The inlined assembly is used outside function, so we can't make my_direct_func static and pass it as asm input argument.

However my_tramp is already extern so I think there's no problem keeping my_direct_func extern as well and just add its prototype.

Fixes 5fae941b9a6f ("ftrace/samples: Add multi direct interface test module")
---
 samples/ftrace/ftrace-direct-multi.c | 1 +
 1 file changed, 1 insertion(+)
samples/ftrace/ftrace-direct-multi.c +0 -0
index 2a5b1fb7ac14..e0ccf43da0c9 100644
@@ -10,6 +10,7 @@ void my_direct_func(unsigned long ip)
 	trace_printk("ip %lx\n", ip);
 }
 
Quoted 6 lines

samples/ftrace/ftrace-direct-multi.c void my_direct_func(unsigned long ip) · line 14

Quoted 2 lines
samples/ftrace/ftrace-direct-multi.c +1 -0
+extern void my_direct_func(unsigned long ip);
 extern void my_tramp(void *);

Except that I believe that the prototype must come before it is used.

I don't think this will fix the warning.

ugh, sry.. v2 posted

jirka

Quoted 7 lines

-- Steve

Quoted 2 lines
samples/ftrace/ftrace-direct-multi.c +0 -0
 asm (