Merge tag 'powerpc-5.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[linux/fpc-iii.git] / kernel / trace / ftrace_internal.h
blob382775edf6902d2da767d369954c245be48de546
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_KERNEL_FTRACE_INTERNAL_H
3 #define _LINUX_KERNEL_FTRACE_INTERNAL_H
5 #ifdef CONFIG_FUNCTION_TRACER
7 extern struct mutex ftrace_lock;
8 extern struct ftrace_ops global_ops;
10 #ifdef CONFIG_DYNAMIC_FTRACE
12 int ftrace_startup(struct ftrace_ops *ops, int command);
13 int ftrace_shutdown(struct ftrace_ops *ops, int command);
14 int ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs);
16 #else /* !CONFIG_DYNAMIC_FTRACE */
18 int __register_ftrace_function(struct ftrace_ops *ops);
19 int __unregister_ftrace_function(struct ftrace_ops *ops);
20 /* Keep as macros so we do not need to define the commands */
21 # define ftrace_startup(ops, command) \
22 ({ \
23 int ___ret = __register_ftrace_function(ops); \
24 if (!___ret) \
25 (ops)->flags |= FTRACE_OPS_FL_ENABLED; \
26 ___ret; \
28 # define ftrace_shutdown(ops, command) \
29 ({ \
30 int ___ret = __unregister_ftrace_function(ops); \
31 if (!___ret) \
32 (ops)->flags &= ~FTRACE_OPS_FL_ENABLED; \
33 ___ret; \
35 static inline int
36 ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs)
38 return 1;
40 #endif /* CONFIG_DYNAMIC_FTRACE */
42 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
43 extern int ftrace_graph_active;
44 void update_function_graph_func(void);
45 #else /* !CONFIG_FUNCTION_GRAPH_TRACER */
46 # define ftrace_graph_active 0
47 static inline void update_function_graph_func(void) { }
48 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
50 #else /* !CONFIG_FUNCTION_TRACER */
51 #endif /* CONFIG_FUNCTION_TRACER */
53 #endif