aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ftrace.h
diff options
context:
space:
mode:
authorAKASHI Takahiro <takahiro.akashi@linaro.org>2014-05-20 07:31:04 -0400
committerSteven Rostedt <rostedt@goodmis.org>2014-05-21 03:10:32 -0400
commiteed542d6962ba33a689b4007a389f466e407bd74 (patch)
treed7ecb07cb30a0d4f20497fa6ef90d3829b4c701a /include/linux/ftrace.h
parentd6d211db37e75de2ddc3a4f979038c40df7cc79c (diff)
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/1400585464-30333-1-git-send-email-takahiro.akashi@linaro.org Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/linux/ftrace.h')
-rw-r--r--include/linux/ftrace.h34
1 files changed, 18 insertions, 16 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index ae9504b4b67d..2018751cad9e 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -616,25 +616,27 @@ static inline void __ftrace_enabled_restore(int enabled)
616#endif 616#endif
617} 617}
618 618
619#ifndef HAVE_ARCH_CALLER_ADDR 619/* All archs should have this, but we define it for consistency */
620#ifndef ftrace_return_address0
621# define ftrace_return_address0 __builtin_return_address(0)
622#endif
623
624/* Archs may use other ways for ADDR1 and beyond */
625#ifndef ftrace_return_address
620# ifdef CONFIG_FRAME_POINTER 626# ifdef CONFIG_FRAME_POINTER
621# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) 627# define ftrace_return_address(n) __builtin_return_address(n)
622# define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1))
623# define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2))
624# define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3))
625# define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4))
626# define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5))
627# define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6))
628# else 628# else
629# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) 629# define ftrace_return_address(n) 0UL
630# define CALLER_ADDR1 0UL
631# define CALLER_ADDR2 0UL
632# define CALLER_ADDR3 0UL
633# define CALLER_ADDR4 0UL
634# define CALLER_ADDR5 0UL
635# define CALLER_ADDR6 0UL
636# endif 630# endif
637#endif /* ifndef HAVE_ARCH_CALLER_ADDR */ 631#endif
632
633#define CALLER_ADDR0 ((unsigned long)ftrace_return_address0)
634#define CALLER_ADDR1 ((unsigned long)ftrace_return_address(1))
635#define CALLER_ADDR2 ((unsigned long)ftrace_return_address(2))
636#define CALLER_ADDR3 ((unsigned long)ftrace_return_address(3))
637#define CALLER_ADDR4 ((unsigned long)ftrace_return_address(4))
638#define CALLER_ADDR5 ((unsigned long)ftrace_return_address(5))
639#define CALLER_ADDR6 ((unsigned long)ftrace_return_address(6))
638 640
639#ifdef CONFIG_IRQSOFF_TRACER 641#ifdef CONFIG_IRQSOFF_TRACER
640 extern void time_hardirqs_on(unsigned long a0, unsigned long a1); 642 extern void time_hardirqs_on(unsigned long a0, unsigned long a1);