diff options
author | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-04-06 09:24:25 -0400 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-04-07 20:24:40 -0400 |
commit | b0dc52f15e7fe2b973ecfe4f3706f1b35ce3943a (patch) | |
tree | 4166441e144cbb6d3a37119829c379ac73963278 /init | |
parent | 4e37958d1288ce90e8b8eb526ed93d6b2ee6cf54 (diff) | |
download | linux-stable-b0dc52f15e7fe2b973ecfe4f3706f1b35ce3943a.tar.gz linux-stable-b0dc52f15e7fe2b973ecfe4f3706f1b35ce3943a.tar.bz2 linux-stable-b0dc52f15e7fe2b973ecfe4f3706f1b35ce3943a.zip |
init: Have initcall_debug still work without CONFIG_TRACEPOINTS
Add macros around the initcall_debug tracepoint code to have the code to
default back to the old method if CONFIG_TRACEPOINTS is not enabled.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'init')
-rw-r--r-- | init/main.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/init/main.c b/init/main.c index 589d1226016e..6f6e6fc6f4b9 100644 --- a/init/main.c +++ b/init/main.c @@ -496,7 +496,14 @@ void __init __weak mem_encrypt_init(void) { } bool initcall_debug; core_param(initcall_debug, initcall_debug, bool, 0644); + +#ifdef TRACEPOINTS_ENABLED static void __init initcall_debug_enable(void); +#else +static inline void initcall_debug_enable(void) +{ +} +#endif /* * Set up kernel memory allocators @@ -832,6 +839,7 @@ trace_initcall_finish_cb(void *data, initcall_t fn, int ret) static ktime_t initcall_calltime; +#ifdef TRACEPOINTS_ENABLED static void __init initcall_debug_enable(void) { int ret; @@ -842,6 +850,22 @@ static void __init initcall_debug_enable(void) &initcall_calltime); WARN(ret, "Failed to register initcall tracepoints\n"); } +# define do_trace_initcall_start trace_initcall_start +# define do_trace_initcall_finish trace_initcall_finish +#else +static inline void do_trace_initcall_start(initcall_t fn) +{ + if (!initcall_debug) + return; + trace_initcall_start_cb(&initcall_calltime, fn); +} +static inline void do_trace_initcall_finish(initcall_t fn, int ret) +{ + if (!initcall_debug) + return; + trace_initcall_finish_cb(&initcall_calltime, fn, ret); +} +#endif /* !TRACEPOINTS_ENABLED */ int __init_or_module do_one_initcall(initcall_t fn) { @@ -852,9 +876,9 @@ int __init_or_module do_one_initcall(initcall_t fn) if (initcall_blacklisted(fn)) return -EPERM; - trace_initcall_start(fn); + do_trace_initcall_start(fn); ret = fn(); - trace_initcall_finish(fn, ret); + do_trace_initcall_finish(fn, ret); msgbuf[0] = 0; |