* [PATCH] tracing: always provide a prototype for tracing_alloc_snapshot()
@ 2026-03-31 8:20 Bartosz Golaszewski
2026-03-31 9:20 ` Masami Hiramatsu
0 siblings, 1 reply; 3+ messages in thread
From: Bartosz Golaszewski @ 2026-03-31 8:20 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers
Cc: linux-kernel, linux-trace-kernel, Bartosz Golaszewski
The tracing_alloc_snapshot() symbol is always exported even with
!CONFIG_TRACER_SNAPSHOT so the prototype too must be always visible or
we'll see the following warning:
kernel/trace/trace.c:820:5: warning: no previous prototype for ‘tracing_alloc_snapshot’ [-Wmissing-prototypes]
820 | int tracing_alloc_snapshot(void)
| ^~~~~~~~~~~~~~~~~~~~~~
Fixes: bade44fe5462 ("tracing: Move snapshot code out of trace.c and into trace_snapshot.c")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
kernel/trace/trace.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 6abd9e16ef21..e8612b8b0a34 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -2275,6 +2275,8 @@ static inline void __init trace_event_init(void) { }
static inline void trace_event_update_all(struct trace_eval_map **map, int len) { }
#endif
+int tracing_alloc_snapshot(void);
+
#ifdef CONFIG_TRACER_SNAPSHOT
extern const struct file_operations snapshot_fops;
extern const struct file_operations snapshot_raw_fops;
@@ -2282,7 +2284,6 @@ extern const struct file_operations snapshot_raw_fops;
/* Used when creating instances */
int trace_allocate_snapshot(struct trace_array *tr, int size);
-int tracing_alloc_snapshot(void);
void tracing_snapshot_cond(struct trace_array *tr, void *cond_data);
int tracing_snapshot_cond_enable(struct trace_array *tr, void *cond_data, cond_update_fn_t update);
int tracing_snapshot_cond_disable(struct trace_array *tr);
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] tracing: always provide a prototype for tracing_alloc_snapshot()
2026-03-31 8:20 [PATCH] tracing: always provide a prototype for tracing_alloc_snapshot() Bartosz Golaszewski
@ 2026-03-31 9:20 ` Masami Hiramatsu
2026-03-31 16:13 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Masami Hiramatsu @ 2026-03-31 9:20 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Steven Rostedt, Mathieu Desnoyers, linux-kernel,
linux-trace-kernel
On Tue, 31 Mar 2026 10:20:01 +0200
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> wrote:
> The tracing_alloc_snapshot() symbol is always exported even with
> !CONFIG_TRACER_SNAPSHOT so the prototype too must be always visible or
> we'll see the following warning:
>
> kernel/trace/trace.c:820:5: warning: no previous prototype for ‘tracing_alloc_snapshot’ [-Wmissing-prototypes]
> 820 | int tracing_alloc_snapshot(void)
> | ^~~~~~~~~~~~~~~~~~~~~~
>
> Fixes: bade44fe5462 ("tracing: Move snapshot code out of trace.c and into trace_snapshot.c")
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Good catch!
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thanks!
> ---
> kernel/trace/trace.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
> index 6abd9e16ef21..e8612b8b0a34 100644
> --- a/kernel/trace/trace.h
> +++ b/kernel/trace/trace.h
> @@ -2275,6 +2275,8 @@ static inline void __init trace_event_init(void) { }
> static inline void trace_event_update_all(struct trace_eval_map **map, int len) { }
> #endif
>
> +int tracing_alloc_snapshot(void);
> +
> #ifdef CONFIG_TRACER_SNAPSHOT
> extern const struct file_operations snapshot_fops;
> extern const struct file_operations snapshot_raw_fops;
> @@ -2282,7 +2284,6 @@ extern const struct file_operations snapshot_raw_fops;
> /* Used when creating instances */
> int trace_allocate_snapshot(struct trace_array *tr, int size);
>
> -int tracing_alloc_snapshot(void);
> void tracing_snapshot_cond(struct trace_array *tr, void *cond_data);
> int tracing_snapshot_cond_enable(struct trace_array *tr, void *cond_data, cond_update_fn_t update);
> int tracing_snapshot_cond_disable(struct trace_array *tr);
> --
> 2.47.3
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] tracing: always provide a prototype for tracing_alloc_snapshot()
2026-03-31 9:20 ` Masami Hiramatsu
@ 2026-03-31 16:13 ` Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2026-03-31 16:13 UTC (permalink / raw)
To: Masami Hiramatsu (Google)
Cc: Bartosz Golaszewski, Mathieu Desnoyers, linux-kernel,
linux-trace-kernel
On Tue, 31 Mar 2026 18:20:36 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> On Tue, 31 Mar 2026 10:20:01 +0200
> Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> wrote:
>
> > The tracing_alloc_snapshot() symbol is always exported even with
> > !CONFIG_TRACER_SNAPSHOT so the prototype too must be always visible or
> > we'll see the following warning:
> >
> > kernel/trace/trace.c:820:5: warning: no previous prototype for ‘tracing_alloc_snapshot’ [-Wmissing-prototypes]
> > 820 | int tracing_alloc_snapshot(void)
> > | ^~~~~~~~~~~~~~~~~~~~~~
> >
> > Fixes: bade44fe5462 ("tracing: Move snapshot code out of trace.c and into trace_snapshot.c")
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
>
> Good catch!
>
> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
But is the wrong fix. I already fixed it properly:
https://patch.msgid.link/20260328101946.2c4ef4a5@robin
It's still in the testing phase but will be going to linux-next this week.
-- Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-31 16:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-31 8:20 [PATCH] tracing: always provide a prototype for tracing_alloc_snapshot() Bartosz Golaszewski
2026-03-31 9:20 ` Masami Hiramatsu
2026-03-31 16:13 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox