diff options
-rw-r--r-- | kernel/trace/trace_events.c | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 9b246eb01d5f..6c81f9c21426 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -76,26 +76,9 @@ static void trace_destroy_fields(struct ftrace_event_call *call) | |||
76 | 76 | ||
77 | #endif /* CONFIG_MODULES */ | 77 | #endif /* CONFIG_MODULES */ |
78 | 78 | ||
79 | static void ftrace_clear_events(void) | ||
80 | { | ||
81 | struct ftrace_event_call *call; | ||
82 | |||
83 | mutex_lock(&event_mutex); | ||
84 | list_for_each_entry(call, &ftrace_events, list) { | ||
85 | |||
86 | if (call->enabled) { | ||
87 | call->enabled = 0; | ||
88 | tracing_stop_cmdline_record(); | ||
89 | call->unregfunc(); | ||
90 | } | ||
91 | } | ||
92 | mutex_unlock(&event_mutex); | ||
93 | } | ||
94 | |||
95 | static void ftrace_event_enable_disable(struct ftrace_event_call *call, | 79 | static void ftrace_event_enable_disable(struct ftrace_event_call *call, |
96 | int enable) | 80 | int enable) |
97 | { | 81 | { |
98 | |||
99 | switch (enable) { | 82 | switch (enable) { |
100 | case 0: | 83 | case 0: |
101 | if (call->enabled) { | 84 | if (call->enabled) { |
@@ -114,6 +97,17 @@ static void ftrace_event_enable_disable(struct ftrace_event_call *call, | |||
114 | } | 97 | } |
115 | } | 98 | } |
116 | 99 | ||
100 | static void ftrace_clear_events(void) | ||
101 | { | ||
102 | struct ftrace_event_call *call; | ||
103 | |||
104 | mutex_lock(&event_mutex); | ||
105 | list_for_each_entry(call, &ftrace_events, list) { | ||
106 | ftrace_event_enable_disable(call, 0); | ||
107 | } | ||
108 | mutex_unlock(&event_mutex); | ||
109 | } | ||
110 | |||
117 | /* | 111 | /* |
118 | * __ftrace_set_clr_event(NULL, NULL, NULL, set) will set/unset all events. | 112 | * __ftrace_set_clr_event(NULL, NULL, NULL, set) will set/unset all events. |
119 | */ | 113 | */ |
@@ -1059,11 +1053,7 @@ static void trace_module_remove_events(struct module *mod) | |||
1059 | list_for_each_entry_safe(call, p, &ftrace_events, list) { | 1053 | list_for_each_entry_safe(call, p, &ftrace_events, list) { |
1060 | if (call->mod == mod) { | 1054 | if (call->mod == mod) { |
1061 | found = true; | 1055 | found = true; |
1062 | if (call->enabled) { | 1056 | ftrace_event_enable_disable(call, 0); |
1063 | call->enabled = 0; | ||
1064 | tracing_stop_cmdline_record(); | ||
1065 | call->unregfunc(); | ||
1066 | } | ||
1067 | if (call->event) | 1057 | if (call->event) |
1068 | unregister_ftrace_event(call->event); | 1058 | unregister_ftrace_event(call->event); |
1069 | debugfs_remove_recursive(call->dir); | 1059 | debugfs_remove_recursive(call->dir); |
@@ -1265,15 +1255,9 @@ static __init void event_trace_self_tests(void) | |||
1265 | continue; | 1255 | continue; |
1266 | } | 1256 | } |
1267 | 1257 | ||
1268 | call->enabled = 1; | 1258 | ftrace_event_enable_disable(call, 1); |
1269 | tracing_start_cmdline_record(); | ||
1270 | call->regfunc(); | ||
1271 | |||
1272 | event_test_stuff(); | 1259 | event_test_stuff(); |
1273 | 1260 | ftrace_event_enable_disable(call, 0); | |
1274 | call->unregfunc(); | ||
1275 | tracing_stop_cmdline_record(); | ||
1276 | call->enabled = 0; | ||
1277 | 1261 | ||
1278 | pr_cont("OK\n"); | 1262 | pr_cont("OK\n"); |
1279 | } | 1263 | } |