From: Frederic Weisbecker <fweisbec@gmail.com>
Date: Tue, 28 Oct 2008 19:17:38 +0000 (+0100)
Subject: ftrace: perform an initialization for ftrace to enable it
X-Git-Tag: v2.6.28-rc3~50^2~1
X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=0b6e4d56bf71866a2b58daa8323cf747988ce7e4;p=linux-2.6-omap-h63xx.git

ftrace: perform an initialization for ftrace to enable it

Impact: corrects a bug which made the non-dyn function tracer not functional

With latest git, the non-dynamic function tracer didn't get any trace.

The problem was the fact that ftrace_enabled wasn't initialized to 1
because ftrace hasn't any init function when DYNAMIC_FTRACE is disabled.

So when a tracer tries to register an ftrace_ops struct,
__register_ftrace_function failed to set the hook.

This patch corrects it by setting an init function to initialize
ftrace during the boot.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 7618c528756..4a39d24568c 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1339,6 +1339,14 @@ void __init ftrace_init(void)
 }
 
 #else
+
+static int __init ftrace_nodyn_init(void)
+{
+	ftrace_enabled = 1;
+	return 0;
+}
+device_initcall(ftrace_nodyn_init);
+
 # define ftrace_startup()		do { } while (0)
 # define ftrace_shutdown()		do { } while (0)
 # define ftrace_startup_sysctl()	do { } while (0)