kernel/trace/trace_events.c:2102:37: warning: 'ftrace_event_id_fops' defined but not used

From: kernel test robot
Date: Mon Aug 21 2023 - 15:01:51 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f7757129e3dea336c407551c98f50057c22bb266
commit: 93a4fa622eb061f75f87f0cf9609ab4e69c67d01 LoongArch: Add STACKTRACE support
date: 1 year ago
config: loongarch-randconfig-r014-20230821 (https://download.01.org/0day-ci/archive/20230822/202308220210.4uvlS2Zx-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230822/202308220210.4uvlS2Zx-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308220210.4uvlS2Zx-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> kernel/trace/trace_events.c:2102:37: warning: 'ftrace_event_id_fops' defined but not used [-Wunused-const-variable=]
2102 | static const struct file_operations ftrace_event_id_fops = {
| ^~~~~~~~~~~~~~~~~~~~
--
In file included from kernel/locking/lockdep.c:61:
>> kernel/locking/lockdep_internals.h:69:28: warning: 'LOCKF_USED_IN_IRQ_READ' defined but not used [-Wunused-const-variable=]
69 | static const unsigned long LOCKF_USED_IN_IRQ_READ =
| ^~~~~~~~~~~~~~~~~~~~~~
>> kernel/locking/lockdep_internals.h:63:28: warning: 'LOCKF_ENABLED_IRQ_READ' defined but not used [-Wunused-const-variable=]
63 | static const unsigned long LOCKF_ENABLED_IRQ_READ =
| ^~~~~~~~~~~~~~~~~~~~~~
>> kernel/locking/lockdep_internals.h:57:28: warning: 'LOCKF_USED_IN_IRQ' defined but not used [-Wunused-const-variable=]
57 | static const unsigned long LOCKF_USED_IN_IRQ =
| ^~~~~~~~~~~~~~~~~
>> kernel/locking/lockdep_internals.h:51:28: warning: 'LOCKF_ENABLED_IRQ' defined but not used [-Wunused-const-variable=]
51 | static const unsigned long LOCKF_ENABLED_IRQ =
| ^~~~~~~~~~~~~~~~~


vim +/ftrace_event_id_fops +2102 kernel/trace/trace_events.c

981d081ec8b958 Steven Rostedt 2009-03-02 2101
23725aeeab10ba Peter Zijlstra 2009-03-19 @2102 static const struct file_operations ftrace_event_id_fops = {
23725aeeab10ba Peter Zijlstra 2009-03-19 2103 .read = event_id_read,
6038f373a3dc1f Arnd Bergmann 2010-08-15 2104 .llseek = default_llseek,
23725aeeab10ba Peter Zijlstra 2009-03-19 2105 };
23725aeeab10ba Peter Zijlstra 2009-03-19 2106

:::::: The code at line 2102 was first introduced by commit
:::::: 23725aeeab10ba02bcf10ec49ad73146b54cb52f ftrace: provide an id file for each event

:::::: TO: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
:::::: CC: Ingo Molnar <mingo@xxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki