Skip to content

Commit 38de93a

Browse files
tzanussirostedt
authored andcommitted
tracing: Make register/unregister_ftrace_command __init
register/unregister_ftrace_command() are only ever called from __init functions, so can themselves be made __init. Also make register_snapshot_cmd() __init for the same reason. Link: http://lkml.kernel.org/r/d4042c8cadb7ae6f843ac9a89a24e1c6a3099727.1382620672.git.tom.zanussi@linux.intel.com Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent f306cc8 commit 38de93a

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎include/linux/ftrace.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,11 +533,11 @@ static inline int ftrace_force_update(void) { return 0; }
533533
static inline void ftrace_disable_daemon(void) { }
534534
static inline void ftrace_enable_daemon(void) { }
535535
static inline void ftrace_release_mod(struct module *mod) {}
536-
static inline int register_ftrace_command(struct ftrace_func_command *cmd)
536+
static inline __init int register_ftrace_command(struct ftrace_func_command *cmd)
537537
{
538538
return -EINVAL;
539539
}
540-
static inline int unregister_ftrace_command(char *cmd_name)
540+
static inline __init int unregister_ftrace_command(char *cmd_name)
541541
{
542542
return -EINVAL;
543543
}

‎kernel/trace/ftrace.c‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3307,7 +3307,11 @@ void unregister_ftrace_function_probe_all(char *glob)
33073307
static LIST_HEAD(ftrace_commands);
33083308
static DEFINE_MUTEX(ftrace_cmd_mutex);
33093309

3310-
int register_ftrace_command(struct ftrace_func_command *cmd)
3310+
/*
3311+
* Currently we only register ftrace commands from __init, so mark this
3312+
* __init too.
3313+
*/
3314+
__init int register_ftrace_command(struct ftrace_func_command *cmd)
33113315
{
33123316
struct ftrace_func_command *p;
33133317
int ret = 0;
@@ -3326,7 +3330,11 @@ int register_ftrace_command(struct ftrace_func_command *cmd)
33263330
return ret;
33273331
}
33283332

3329-
int unregister_ftrace_command(struct ftrace_func_command *cmd)
3333+
/*
3334+
* Currently we only unregister ftrace commands from __init, so mark
3335+
* this __init too.
3336+
*/
3337+
__init int unregister_ftrace_command(struct ftrace_func_command *cmd)
33303338
{
33313339
struct ftrace_func_command *p, *n;
33323340
int ret = -ENODEV;

‎kernel/trace/trace.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5477,12 +5477,12 @@ static struct ftrace_func_command ftrace_snapshot_cmd = {
54775477
.func = ftrace_trace_snapshot_callback,
54785478
};
54795479

5480-
static int register_snapshot_cmd(void)
5480+
static __init int register_snapshot_cmd(void)
54815481
{
54825482
return register_ftrace_command(&ftrace_snapshot_cmd);
54835483
}
54845484
#else
5485-
static inline int register_snapshot_cmd(void) { return 0; }
5485+
static inline __init int register_snapshot_cmd(void) { return 0; }
54865486
#endif /* defined(CONFIG_TRACER_SNAPSHOT) && defined(CONFIG_DYNAMIC_FTRACE) */
54875487

54885488
struct dentry *tracing_init_dentry_tr(struct trace_array *tr)

0 commit comments

Comments
 (0)