Skip to content

Commit bd69c30

Browse files
Steven Rostedtrostedt
authored andcommitted
ftrace: Add ops parameter to ftrace_startup/shutdown functions
In order to allow different ops to enable different functions, the ftrace_startup() and ftrace_shutdown() functions need the ops parameter passed to them. Signed-off-by: Steven Rostedt <[email protected]>
1 parent 647bcd0 commit bd69c30

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

kernel/trace/ftrace.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,10 +1522,8 @@ static void ftrace_startup_enable(int command)
15221522
ftrace_run_update_code(command);
15231523
}
15241524

1525-
static void ftrace_startup(int command)
1525+
static void ftrace_startup(struct ftrace_ops *ops, int command)
15261526
{
1527-
struct ftrace_ops *ops = &global_ops;
1528-
15291527
if (unlikely(ftrace_disabled))
15301528
return;
15311529

@@ -1539,10 +1537,8 @@ static void ftrace_startup(int command)
15391537
ftrace_startup_enable(command);
15401538
}
15411539

1542-
static void ftrace_shutdown(int command)
1540+
static void ftrace_shutdown(struct ftrace_ops *ops, int command)
15431541
{
1544-
struct ftrace_ops *ops = &global_ops;
1545-
15461542
if (unlikely(ftrace_disabled))
15471543
return;
15481544

@@ -2362,7 +2358,7 @@ static void __enable_ftrace_function_probe(void)
23622358
return;
23632359

23642360
__register_ftrace_function(&trace_probe_ops);
2365-
ftrace_startup(0);
2361+
ftrace_startup(&global_ops, 0);
23662362
ftrace_probe_registered = 1;
23672363
}
23682364

@@ -2381,7 +2377,7 @@ static void __disable_ftrace_function_probe(void)
23812377

23822378
/* no more funcs left */
23832379
__unregister_ftrace_function(&trace_probe_ops);
2384-
ftrace_shutdown(0);
2380+
ftrace_shutdown(&global_ops, 0);
23852381
ftrace_probe_registered = 0;
23862382
}
23872383

@@ -3267,6 +3263,10 @@ void __init ftrace_init(void)
32673263

32683264
#else
32693265

3266+
struct ftrace_ops global_ops = {
3267+
.func = ftrace_stub,
3268+
};
3269+
32703270
static int __init ftrace_nodyn_init(void)
32713271
{
32723272
ftrace_enabled = 1;
@@ -3277,8 +3277,8 @@ device_initcall(ftrace_nodyn_init);
32773277
static inline int ftrace_init_dyn_debugfs(struct dentry *d_tracer) { return 0; }
32783278
static inline void ftrace_startup_enable(int command) { }
32793279
/* Keep as macros so we do not need to define the commands */
3280-
# define ftrace_startup(command) do { } while (0)
3281-
# define ftrace_shutdown(command) do { } while (0)
3280+
# define ftrace_startup(ops, command) do { } while (0)
3281+
# define ftrace_shutdown(ops, command) do { } while (0)
32823282
# define ftrace_startup_sysctl() do { } while (0)
32833283
# define ftrace_shutdown_sysctl() do { } while (0)
32843284
#endif /* CONFIG_DYNAMIC_FTRACE */
@@ -3583,7 +3583,7 @@ int register_ftrace_function(struct ftrace_ops *ops)
35833583
goto out_unlock;
35843584

35853585
ret = __register_ftrace_function(ops);
3586-
ftrace_startup(0);
3586+
ftrace_startup(&global_ops, 0);
35873587

35883588
out_unlock:
35893589
mutex_unlock(&ftrace_lock);
@@ -3602,7 +3602,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops)
36023602

36033603
mutex_lock(&ftrace_lock);
36043604
ret = __unregister_ftrace_function(ops);
3605-
ftrace_shutdown(0);
3605+
ftrace_shutdown(&global_ops, 0);
36063606
mutex_unlock(&ftrace_lock);
36073607

36083608
return ret;
@@ -3825,7 +3825,7 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
38253825
ftrace_graph_return = retfunc;
38263826
ftrace_graph_entry = entryfunc;
38273827

3828-
ftrace_startup(FTRACE_START_FUNC_RET);
3828+
ftrace_startup(&global_ops, FTRACE_START_FUNC_RET);
38293829

38303830
out:
38313831
mutex_unlock(&ftrace_lock);
@@ -3842,7 +3842,7 @@ void unregister_ftrace_graph(void)
38423842
ftrace_graph_active--;
38433843
ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
38443844
ftrace_graph_entry = ftrace_graph_entry_stub;
3845-
ftrace_shutdown(FTRACE_STOP_FUNC_RET);
3845+
ftrace_shutdown(&global_ops, FTRACE_STOP_FUNC_RET);
38463846
unregister_pm_notifier(&ftrace_suspend_notifier);
38473847
unregister_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL);
38483848

0 commit comments

Comments
 (0)