Skip to content

Commit 424b650

Browse files
JackieLiu1rostedt
authored andcommitted
tracing: Fix missing osnoise tracer on max_latency
The compiler warns when the data are actually unused: kernel/trace/trace.c:1712:13: error: ‘trace_create_maxlat_file’ defined but not used [-Werror=unused-function] 1712 | static void trace_create_maxlat_file(struct trace_array *tr, | ^~~~~~~~~~~~~~~~~~~~~~~~ [Why] CONFIG_HWLAT_TRACER=n, CONFIG_TRACER_MAX_TRACE=n, CONFIG_OSNOISE_TRACER=y gcc report warns. [How] Now trace_create_maxlat_file will only take effect when CONFIG_HWLAT_TRACER=y or CONFIG_TRACER_MAX_TRACE=y. In fact, after adding osnoise trace, it also needs to take effect. Link: https://lore.kernel.org/all/[email protected]/ Link: https://lkml.kernel.org/r/[email protected] Fixes: bce29ac ("trace: Add osnoise tracer") Cc: Daniel Bristot de Oliveira <[email protected]> Suggested-by: Steven Rostedt <[email protected]> Reviewed-by: Daniel Bristot de Oliveira <[email protected]> Tested-by: Randy Dunlap <[email protected]> # build-tested Signed-off-by: Jackie Liu <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 5816b3e commit 424b650

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

kernel/trace/trace.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,16 +1744,15 @@ void latency_fsnotify(struct trace_array *tr)
17441744
irq_work_queue(&tr->fsnotify_irqwork);
17451745
}
17461746

1747-
/*
1748-
* (defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)) && \
1749-
* defined(CONFIG_FSNOTIFY)
1750-
*/
1751-
#else
1747+
#elif defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER) \
1748+
|| defined(CONFIG_OSNOISE_TRACER)
17521749

17531750
#define trace_create_maxlat_file(tr, d_tracer) \
17541751
trace_create_file("tracing_max_latency", 0644, d_tracer, \
17551752
&tr->max_latency, &tracing_max_lat_fops)
17561753

1754+
#else
1755+
#define trace_create_maxlat_file(tr, d_tracer) do { } while (0)
17571756
#endif
17581757

17591758
#ifdef CONFIG_TRACER_MAX_TRACE
@@ -9473,9 +9472,7 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer)
94739472

94749473
create_trace_options_dir(tr);
94759474

9476-
#if defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)
94779475
trace_create_maxlat_file(tr, d_tracer);
9478-
#endif
94799476

94809477
if (ftrace_create_function_files(tr, d_tracer))
94819478
MEM_FAIL(1, "Could not allocate function filter files");

0 commit comments

Comments
 (0)