mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tracing: hide unused functions
@ 2017-10-13 12:01 Arnd Bergmann
  2017-10-13 13:02 ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2017-10-13 12:01 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar; +Cc: Arnd Bergmann, Joel Fernandes, linux-kernel

After trace_selftest_startup_sched_switch is removed, trace_test_buffer()
is now only used inside of CONFIG_FUNCTION_TRACER, leading to this
warning:

kernel/trace/trace_selftest.c:62:12: error: 'trace_test_buffer' defined but not used [-Werror=unused-function]

The same is true for a few other functions called by trace_test_buffer(),
so let's extend the #ifdef to cover all of them together.

Fixes: d8c4deee6dc6 ("tracing: Remove obsolete sched_switch tracer selftest")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/trace/trace_selftest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index 364f78abdf47..bcdffeca9bd8 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -6,6 +6,8 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 
+#ifdef CONFIG_FUNCTION_TRACER
+
 static inline int trace_valid_entry(struct trace_entry *entry)
 {
 	switch (entry->type) {
@@ -98,7 +100,6 @@ static inline void warn_failed_init_tracer(struct tracer *trace, int init_ret)
 	printk(KERN_WARNING "Failed to init %s tracer, init returned %d\n",
 		trace->name, init_ret);
 }
-#ifdef CONFIG_FUNCTION_TRACER
 
 #ifdef CONFIG_DYNAMIC_FTRACE
 
-- 
2.9.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tracing: hide unused functions
  2017-10-13 12:01 [PATCH] tracing: hide unused functions Arnd Bergmann
@ 2017-10-13 13:02 ` Arnd Bergmann
  2017-10-13 13:24   ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2017-10-13 13:02 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar
  Cc: Arnd Bergmann, Joel Fernandes, Linux Kernel Mailing List

On Fri, Oct 13, 2017 at 2:01 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> After trace_selftest_startup_sched_switch is removed, trace_test_buffer()
> is now only used inside of CONFIG_FUNCTION_TRACER, leading to this
> warning:
>
> kernel/trace/trace_selftest.c:62:12: error: 'trace_test_buffer' defined but not used [-Werror=unused-function]
>
> The same is true for a few other functions called by trace_test_buffer(),
> so let's extend the #ifdef to cover all of them together.
>
> Fixes: d8c4deee6dc6 ("tracing: Remove obsolete sched_switch tracer selftest")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Nevermind, I ran into another problem with this applied: trace_test_buffer()
is used elsewhere after all, just not for all possible combinations.

Maybe marking it as __maybe_unused would be more appropriate?

      Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tracing: hide unused functions
  2017-10-13 13:02 ` Arnd Bergmann
@ 2017-10-13 13:24   ` Steven Rostedt
  0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2017-10-13 13:24 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Ingo Molnar, Joel Fernandes, Linux Kernel Mailing List

On Fri, 13 Oct 2017 15:02:34 +0200
Arnd Bergmann <arnd@arndb.de> wrote:

> On Fri, Oct 13, 2017 at 2:01 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > After trace_selftest_startup_sched_switch is removed, trace_test_buffer()
> > is now only used inside of CONFIG_FUNCTION_TRACER, leading to this
> > warning:
> >
> > kernel/trace/trace_selftest.c:62:12: error: 'trace_test_buffer' defined but not used [-Werror=unused-function]
> >
> > The same is true for a few other functions called by trace_test_buffer(),
> > so let's extend the #ifdef to cover all of them together.
> >
> > Fixes: d8c4deee6dc6 ("tracing: Remove obsolete sched_switch tracer selftest")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>  
> 
> Nevermind, I ran into another problem with this applied: trace_test_buffer()
> is used elsewhere after all, just not for all possible combinations.
> 
> Maybe marking it as __maybe_unused would be more appropriate?

If that quiets the warning for you. This selftest code isn't something
for production, so it shouldn't be that critical. It's only used to
sanity check various parts of tracing.

-- Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-13 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-13 12:01 [PATCH] tracing: hide unused functions Arnd Bergmann
2017-10-13 13:02 ` Arnd Bergmann
2017-10-13 13:24   ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®