ftrace: Make CALLER_ADDRx macros more generic

Most archs with HAVE_ARCH_CALLER_ADDR have pretty much the same
definitions of CALLER_ADDRx(n). Instead of duplicating the code for all
the archs, define a ftrace_return_address0() and
ftrace_return_address(n) that can be overwritten by the archs if they
need to do something different. Instead of 7 macros in every arch, we
now only have at most 2 (and actually only 1 as
ftrace_return_address0() should be the same for all archs).

The CALLER_ADDRx(n) will now be defined in linux/ftrace.h and use the
ftrace_return_address*(n?) macros. This removes a lot of the duplicate
code.

Link: http://lkml.kernel.org/p/[email protected]

Signed-off-by: AKASHI Takahiro <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
This commit is contained in:
AKASHI Takahiro 2014-05-20 20:31:04 +09:00 • committed by Steven Rostedt
commit eed542d696
6 changed files with 26 additions and 63 deletions

View file

@ -24,15 +24,7 @@ extern void return_to_handler(void);
extern unsigned long return_address(unsigned int);
#define HAVE_ARCH_CALLER_ADDR
#define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
#define CALLER_ADDR1 return_address(1)
#define CALLER_ADDR2 return_address(2)
#define CALLER_ADDR3 return_address(3)
#define CALLER_ADDR4 return_address(4)
#define CALLER_ADDR5 return_address(5)
#define CALLER_ADDR6 return_address(6)
#define ftrace_return_address(n) return_address(n)
#endif /* __ASSEMBLY__ */