Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 21a8c466 authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Ingo Molnar
Browse files

tracing/ftrace: provide the macro task_curr_ret_stack()



Impact: cleanup

As suggested by Steven Rostedt, this patch provide a new macro
task_curr_ret_stack() to move the cpp conditionnal CONFIG into
the linux/ftrace.h headers.

Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 77d683f3
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -8,6 +8,7 @@
#include <linux/types.h>
#include <linux/types.h>
#include <linux/kallsyms.h>
#include <linux/kallsyms.h>
#include <linux/bitops.h>
#include <linux/bitops.h>
#include <linux/sched.h>


#ifdef CONFIG_FUNCTION_TRACER
#ifdef CONFIG_FUNCTION_TRACER


@@ -387,9 +388,19 @@ extern void unregister_ftrace_graph(void);


extern void ftrace_graph_init_task(struct task_struct *t);
extern void ftrace_graph_init_task(struct task_struct *t);
extern void ftrace_graph_exit_task(struct task_struct *t);
extern void ftrace_graph_exit_task(struct task_struct *t);

static inline int task_curr_ret_stack(struct task_struct *t)
{
	return t->curr_ret_stack;
}
#else
#else
static inline void ftrace_graph_init_task(struct task_struct *t) { }
static inline void ftrace_graph_init_task(struct task_struct *t) { }
static inline void ftrace_graph_exit_task(struct task_struct *t) { }
static inline void ftrace_graph_exit_task(struct task_struct *t) { }

static inline int task_curr_ret_stack(struct task_struct *tsk)
{
	return -1;
}
#endif
#endif


#ifdef CONFIG_TRACING
#ifdef CONFIG_TRACING
+1 −7
Original line number Original line Diff line number Diff line
@@ -3657,13 +3657,7 @@ int __ftrace_printk(unsigned long ip, const char *fmt, ...)
		return 0;
		return 0;


	va_start(ap, fmt);
	va_start(ap, fmt);

	ret = trace_vprintk(ip, task_curr_ret_stack(current), fmt, ap);
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
	ret = trace_vprintk(ip, current->curr_ret_stack, fmt, ap);
#else
	ret = trace_vprintk(ip, -1, fmt, ap);
#endif

	va_end(ap);
	va_end(ap);
	return ret;
	return ret;
}
}