Messages in this thread Patch in this message | | | From | Sebastian Andrzej Siewior <> | Subject | [PATCH 1/2] ftrace: move the CALLER_ADDRx macros into its own header | Date | Fri, 12 Feb 2016 00:21:06 +0100 |
| |
This patch moves the CALLER_ADDRx macros into their own header so it is not required to include ftrace.h just for them.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- include/linux/ftrace.h | 25 +------------------------ include/linux/ftrace_caller.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 24 deletions(-) create mode 100644 include/linux/ftrace_caller.h
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 81de7123959d..83193c717cb9 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -16,8 +16,7 @@ #include <linux/types.h> #include <linux/init.h> #include <linux/fs.h> - -#include <asm/ftrace.h> +#include <linux/ftrace_caller.h> /* * If the arch supports passing the variable contents of @@ -689,28 +688,6 @@ static inline void __ftrace_enabled_restore(int enabled) #endif } -/* All archs should have this, but we define it for consistency */ -#ifndef ftrace_return_address0 -# define ftrace_return_address0 __builtin_return_address(0) -#endif - -/* Archs may use other ways for ADDR1 and beyond */ -#ifndef ftrace_return_address -# ifdef CONFIG_FRAME_POINTER -# define ftrace_return_address(n) __builtin_return_address(n) -# else -# define ftrace_return_address(n) 0UL -# endif -#endif - -#define CALLER_ADDR0 ((unsigned long)ftrace_return_address0) -#define CALLER_ADDR1 ((unsigned long)ftrace_return_address(1)) -#define CALLER_ADDR2 ((unsigned long)ftrace_return_address(2)) -#define CALLER_ADDR3 ((unsigned long)ftrace_return_address(3)) -#define CALLER_ADDR4 ((unsigned long)ftrace_return_address(4)) -#define CALLER_ADDR5 ((unsigned long)ftrace_return_address(5)) -#define CALLER_ADDR6 ((unsigned long)ftrace_return_address(6)) - #ifdef CONFIG_IRQSOFF_TRACER extern void time_hardirqs_on(unsigned long a0, unsigned long a1); extern void time_hardirqs_off(unsigned long a0, unsigned long a1); diff --git a/include/linux/ftrace_caller.h b/include/linux/ftrace_caller.h new file mode 100644 index 000000000000..887a7c220cd6 --- /dev/null +++ b/include/linux/ftrace_caller.h @@ -0,0 +1,28 @@ +#ifndef _LINUX_FTRACE_CALLER_H +#define _LINUX_FTRACE_CALLER_H + +#include <asm/ftrace.h> + +/* All archs should have this, but we define it for consistency */ +#ifndef ftrace_return_address0 +# define ftrace_return_address0 __builtin_return_address(0) +#endif + +/* Archs may use other ways for ADDR1 and beyond */ +#ifndef ftrace_return_address +# ifdef CONFIG_FRAME_POINTER +# define ftrace_return_address(n) __builtin_return_address(n) +# else +# define ftrace_return_address(n) 0UL +# endif +#endif + +#define CALLER_ADDR0 ((unsigned long)ftrace_return_address0) +#define CALLER_ADDR1 ((unsigned long)ftrace_return_address(1)) +#define CALLER_ADDR2 ((unsigned long)ftrace_return_address(2)) +#define CALLER_ADDR3 ((unsigned long)ftrace_return_address(3)) +#define CALLER_ADDR4 ((unsigned long)ftrace_return_address(4)) +#define CALLER_ADDR5 ((unsigned long)ftrace_return_address(5)) +#define CALLER_ADDR6 ((unsigned long)ftrace_return_address(6)) + +#endif -- 2.7.0
| |