mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	 4267fda4af
			
		
	
	
		4267fda4af
		
	
	
	
	
		
			
			When CONFIG_DYNAMIC_FTRACE is not set, the function fgraph_update_pid_func() doesn't do anything. Currently, most of its logic is within a "#ifdef CONFIG_DYNAMIC_FTRACE" block, but its variables were declared outside that, and when DYNAMIC_FTRACE is not set, it produces unused variable warnings. Instead, just place it (and the helper function fgraph_pid_func()) within the #ifdef block and have the header file use a empty stub function for when DYNAMIC_FTRACE is not defined. Link: https://lore.kernel.org/linux-trace-kernel/20240607094833.6a787d73@rorschach.local.home Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202406071806.BRjaC5FF-lkp@intel.com/ Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
		
			
				
	
	
		
			68 lines
		
	
	
	
		
			2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			68 lines
		
	
	
	
		
			2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /* SPDX-License-Identifier: GPL-2.0 */
 | |
| #ifndef _LINUX_KERNEL_FTRACE_INTERNAL_H
 | |
| #define  _LINUX_KERNEL_FTRACE_INTERNAL_H
 | |
| 
 | |
| int __register_ftrace_function(struct ftrace_ops *ops);
 | |
| int __unregister_ftrace_function(struct ftrace_ops *ops);
 | |
| 
 | |
| #ifdef CONFIG_FUNCTION_TRACER
 | |
| 
 | |
| extern struct mutex ftrace_lock;
 | |
| extern struct ftrace_ops global_ops;
 | |
| 
 | |
| #ifdef CONFIG_DYNAMIC_FTRACE
 | |
| 
 | |
| int ftrace_startup(struct ftrace_ops *ops, int command);
 | |
| int ftrace_shutdown(struct ftrace_ops *ops, int command);
 | |
| int ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs);
 | |
| int ftrace_startup_subops(struct ftrace_ops *ops, struct ftrace_ops *subops, int command);
 | |
| int ftrace_shutdown_subops(struct ftrace_ops *ops, struct ftrace_ops *subops, int command);
 | |
| 
 | |
| #else /* !CONFIG_DYNAMIC_FTRACE */
 | |
| 
 | |
| /* Keep as macros so we do not need to define the commands */
 | |
| # define ftrace_startup(ops, command)					\
 | |
| 	({								\
 | |
| 		int ___ret = __register_ftrace_function(ops);		\
 | |
| 		if (!___ret)						\
 | |
| 			(ops)->flags |= FTRACE_OPS_FL_ENABLED;		\
 | |
| 		___ret;							\
 | |
| 	})
 | |
| # define ftrace_shutdown(ops, command)					\
 | |
| 	({								\
 | |
| 		int ___ret = __unregister_ftrace_function(ops);		\
 | |
| 		if (!___ret)						\
 | |
| 			(ops)->flags &= ~FTRACE_OPS_FL_ENABLED;		\
 | |
| 		___ret;							\
 | |
| 	})
 | |
| static inline int
 | |
| ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs)
 | |
| {
 | |
| 	return 1;
 | |
| }
 | |
| static inline int ftrace_startup_subops(struct ftrace_ops *ops, struct ftrace_ops *subops, int command)
 | |
| {
 | |
| 	return -EINVAL;
 | |
| }
 | |
| static inline int ftrace_shutdown_subops(struct ftrace_ops *ops, struct ftrace_ops *subops, int command)
 | |
| {
 | |
| 	return -EINVAL;
 | |
| }
 | |
| #endif /* CONFIG_DYNAMIC_FTRACE */
 | |
| 
 | |
| #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 | |
| extern int ftrace_graph_active;
 | |
| # ifdef CONFIG_DYNAMIC_FTRACE
 | |
| extern void fgraph_update_pid_func(void);
 | |
| # else
 | |
| static inline void fgraph_update_pid_func(void) {}
 | |
| # endif
 | |
| #else /* !CONFIG_FUNCTION_GRAPH_TRACER */
 | |
| # define ftrace_graph_active 0
 | |
| static inline void fgraph_update_pid_func(void) {}
 | |
| #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
 | |
| 
 | |
| #else /* !CONFIG_FUNCTION_TRACER */
 | |
| #endif /* CONFIG_FUNCTION_TRACER */
 | |
| 
 | |
| #endif
 |