Re: [PATCH] x86/ftrace: avoid an unused-function warning
From: Steven Rostedt
Date: Mon Mar 04 2019 - 16:43:12 EST
On Mon, 4 Mar 2019 21:07:39 +0100
Arnd Bergmann <arnd@xxxxxxxx> wrote:
> Depending on the configuration, ftrace_jmp_replace() sometimes
> has no callers at all, since one of the users was removed:
>
> arch/x86/kernel/ftrace.c:669:23: error: 'ftrace_jmp_replace' defined but not used [-Werror=unused-function]
>
> Rather than trying to figure out the correct #ifdef check for this
> time, just mark it __maybe_unused and let the compiler drop it
> silently.
>
Actually, its now only used in one place (that git grep shows).
Changing it to "__maybe_unused" is a copout, and really shouldn't be
something we do for a static function, especially since it's only used
in a single location.
Also, it's basically identical to ftrace_call_replace(). I'm going to
combine the two and move the jmp replace and have it do this instead.
-- Steve