Commit 5281ec83 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Steven Rostedt (Google)

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/20240403080702.3509288-7-arnd@kernel.org

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Zheng Yejian <zhengyejian1@huawei.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Ajay Kaher <akaher@vmware.com>
Cc: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: Clément Léger <cleger@rivosinc.com>
Cc: Dan Carpenter <dan.carpenter@linaro.org>
Cc: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Fixes: 620a30e9 ("tracing: Don't pass file_operations array to event_create_dir()")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent d96c3600
...@@ -1670,6 +1670,7 @@ static int trace_format_open(struct inode *inode, struct file *file) ...@@ -1670,6 +1670,7 @@ static int trace_format_open(struct inode *inode, struct file *file)
return 0; return 0;
} }
#ifdef CONFIG_PERF_EVENTS
static ssize_t static ssize_t
event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
{ {
...@@ -1684,6 +1685,7 @@ event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) ...@@ -1684,6 +1685,7 @@ event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
return simple_read_from_buffer(ubuf, cnt, ppos, buf, len); return simple_read_from_buffer(ubuf, cnt, ppos, buf, len);
} }
#endif
static ssize_t static ssize_t
event_filter_read(struct file *filp, char __user *ubuf, size_t cnt, 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 = { ...@@ -2152,10 +2154,12 @@ static const struct file_operations ftrace_event_format_fops = {
.release = seq_release, .release = seq_release,
}; };
#ifdef CONFIG_PERF_EVENTS
static const struct file_operations ftrace_event_id_fops = { static const struct file_operations ftrace_event_id_fops = {
.read = event_id_read, .read = event_id_read,
.llseek = default_llseek, .llseek = default_llseek,
}; };
#endif
static const struct file_operations ftrace_event_filter_fops = { static const struct file_operations ftrace_event_filter_fops = {
.open = tracing_open_file_tr, .open = tracing_open_file_tr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment