Skip to content

Commit 5281ec8

Browse files
arndbrostedt
authored andcommitted
tracing: hide unused ftrace_event_id_fops
When CONFIG_PERF_EVENTS, a 'make W=1' build produces a warning about the unused ftrace_event_id_fops variable: kernel/trace/trace_events.c:2155:37: error: 'ftrace_event_id_fops' defined but not used [-Werror=unused-const-variable=] 2155 | static const struct file_operations ftrace_event_id_fops = { Hide this in the same #ifdef as the reference to it. Link: https://lore.kernel.org/linux-trace-kernel/[email protected] Cc: Masami Hiramatsu <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Zheng Yejian <[email protected]> Cc: Kees Cook <[email protected]> Cc: Ajay Kaher <[email protected]> Cc: Jinjie Ruan <[email protected]> Cc: Clément Léger <[email protected]> Cc: Dan Carpenter <[email protected]> Cc: "Tzvetomir Stoyanov (VMware)" <[email protected]> Fixes: 620a30e ("tracing: Don't pass file_operations array to event_create_dir()") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent d96c360 commit 5281ec8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kernel/trace/trace_events.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,6 +1670,7 @@ static int trace_format_open(struct inode *inode, struct file *file)
16701670
return 0;
16711671
}
16721672

1673+
#ifdef CONFIG_PERF_EVENTS
16731674
static ssize_t
16741675
event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
16751676
{
@@ -1684,6 +1685,7 @@ event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
16841685

16851686
return simple_read_from_buffer(ubuf, cnt, ppos, buf, len);
16861687
}
1688+
#endif
16871689

16881690
static ssize_t
16891691
event_filter_read(struct file *filp, char __user *ubuf, size_t cnt,
@@ -2152,10 +2154,12 @@ static const struct file_operations ftrace_event_format_fops = {
21522154
.release = seq_release,
21532155
};
21542156

2157+
#ifdef CONFIG_PERF_EVENTS
21552158
static const struct file_operations ftrace_event_id_fops = {
21562159
.read = event_id_read,
21572160
.llseek = default_llseek,
21582161
};
2162+
#endif
21592163

21602164
static const struct file_operations ftrace_event_filter_fops = {
21612165
.open = tracing_open_file_tr,

0 commit comments

Comments
 (0)