ftrace: fix building with SYSCTL=n but DYNAMIC_FTRACE=y
authorLuis Chamberlain <mcgrof@kernel.org>
Fri, 15 Apr 2022 21:29:57 +0000 (14:29 -0700)
committerLuis Chamberlain <mcgrof@kernel.org>
Thu, 21 Apr 2022 18:25:18 +0000 (11:25 -0700)
commitf8b7d2b4c192118c37ab24c0540d1134dd0104d8
treebf296d2d8a75e70b63bb3d9bd31f0f91da4b2d1e
parent5d79fa0d33258d8e79064316ce8fae37e27bd34b
ftrace: fix building with SYSCTL=n but DYNAMIC_FTRACE=y

One can enable dyanmic tracing but disable sysctls.
When this is doen we get the compile kernel warning:

  CC      kernel/trace/ftrace.o
kernel/trace/ftrace.c:3086:13: warning: ‘ftrace_shutdown_sysctl’ defined
but not used [-Wunused-function]
 3086 | static void ftrace_shutdown_sysctl(void)
      |             ^~~~~~~~~~~~~~~~~~~~~~
kernel/trace/ftrace.c:3068:13: warning: ‘ftrace_startup_sysctl’ defined
but not used [-Wunused-function]
 3068 | static void ftrace_startup_sysctl(void)

When CONFIG_DYNAMIC_FTRACE=n the ftrace_startup_sysctl() and
routines ftrace_shutdown_sysctl() still compiles, so these
are actually more just used for when SYSCTL=y.

Fix this then by just moving these routines to when sysctls
are enabled.

Fixes: 7cde53da38a3 ("ftrace: move sysctl_ftrace_enabled to ftrace.c")
Reported-by: kernel test robot <lkp@intel.com>
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
kernel/trace/ftrace.c