]> Git Repo - linux.git/commitdiff
tracing: hide unused ftrace_event_id_fops
authorArnd Bergmann <[email protected]>
Wed, 3 Apr 2024 08:06:24 +0000 (10:06 +0200)
committerSteven Rostedt (Google) <[email protected]>
Thu, 11 Apr 2024 21:46:55 +0000 (17:46 -0400)
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: 620a30e97feb ("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]>
kernel/trace/trace_events.c

index 7c364b87352eed92e0f76137091882231f187028..52f75c36bbca4922bec786815bb70ff409f62a61 100644 (file)
@@ -1670,6 +1670,7 @@ static int trace_format_open(struct inode *inode, struct file *file)
        return 0;
 }
 
+#ifdef CONFIG_PERF_EVENTS
 static ssize_t
 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);
 }
+#endif
 
 static ssize_t
 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 = {
        .release = seq_release,
 };
 
+#ifdef CONFIG_PERF_EVENTS
 static const struct file_operations ftrace_event_id_fops = {
        .read = event_id_read,
        .llseek = default_llseek,
 };
+#endif
 
 static const struct file_operations ftrace_event_filter_fops = {
        .open = tracing_open_file_tr,
This page took 0.065445 seconds and 4 git commands to generate.