Re: [gustavoars:for-next/cast-function 1/3] kernel/trace/ftrace.c:7029:6: error: no previous prototype for function 'arch_ftrace_ops_list_func'

From: Gustavo A. R. Silva
Date: Thu Oct 14 2021 - 14:10:35 EST


On Thu, Oct 14, 2021 at 01:53:17PM -0400, Steven Rostedt wrote:
> This should fix this issue as well as some of the other ones reported on
> this commit.
>
> [ I'll be adding this update to my own version in my tree ]

Great. I'll apply it to my tree. Thanks! :)

--
Gustavo

>
> -- Steve
>
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index b86f52683b6f..8771c435f34b 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -178,7 +178,8 @@
> ftrace_ops_list_func = arch_ftrace_ops_list_func;
> #else
> # ifdef CONFIG_FUNCTION_TRACER
> -# define MCOUNT_REC() ftrace_stub_graph = ftrace_stub;
> +# define MCOUNT_REC() ftrace_stub_graph = ftrace_stub; \
> + ftrace_ops_list_func = arch_ftrace_ops_list_func;
> # else
> # define MCOUNT_REC()
> # endif
> diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> index 832e65f06754..871b51bec170 100644
> --- a/include/linux/ftrace.h
> +++ b/include/linux/ftrace.h
> @@ -30,16 +30,25 @@
> #define ARCH_SUPPORTS_FTRACE_OPS 0
> #endif
>
> +#ifdef CONFIG_FUNCTION_TRACER
> +struct ftrace_ops;
> /*
> * If the arch's mcount caller does not support all of ftrace's
> * features, then it must call an indirect function that
> * does. Or at least does enough to prevent any unwelcome side effects.
> + *
> + * Also define the function prototype that these architectures use
> + * to call the ftrace_ops_list_func().
> */
> #if !ARCH_SUPPORTS_FTRACE_OPS
> # define FTRACE_FORCE_LIST_FUNC 1
> +void arch_ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip);
> #else
> # define FTRACE_FORCE_LIST_FUNC 0
> +void arch_ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
> + struct ftrace_ops *op, struct ftrace_regs *fregs);
> #endif
> +#endif /* CONFIG_FUNCTION_TRACER */
>
> /* Main tracing buffer and events set up */
> #ifdef CONFIG_TRACING
> @@ -88,8 +97,6 @@ extern int
> ftrace_enable_sysctl(struct ctl_table *table, int write,
> void *buffer, size_t *lenp, loff_t *ppos);
>
> -struct ftrace_ops;
> -
> #ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
>
> struct ftrace_regs {