diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2013-03-09 08:36:53 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2013-03-15 00:35:58 -0400 |
commit | 1c31714328be90764e46716f31fb0bd6da44c305 (patch) | |
tree | 749d35b272ef7bc5f7c1ee84070d23afe2b425a5 | |
parent | 1b22e382ab40b0e3ee5abb3e310dffb16fee22aa (diff) |
tracing: Consolidate updating of count for traceon/off
Remove some duplicate code and replace it with a helper function.
This makes the code a it cleaner.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | kernel/trace/trace_functions.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index e467c0c7bdd5..38cfb290ecd9 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c | |||
@@ -214,38 +214,37 @@ static struct tracer function_trace __read_mostly = | |||
214 | }; | 214 | }; |
215 | 215 | ||
216 | #ifdef CONFIG_DYNAMIC_FTRACE | 216 | #ifdef CONFIG_DYNAMIC_FTRACE |
217 | static void | 217 | static int update_count(void **data) |
218 | ftrace_traceon(unsigned long ip, unsigned long parent_ip, void **data) | ||
219 | { | 218 | { |
220 | long *count = (long *)data; | 219 | unsigned long *count = (long *)data; |
221 | |||
222 | if (tracing_is_on()) | ||
223 | return; | ||
224 | 220 | ||
225 | if (!*count) | 221 | if (!*count) |
226 | return; | 222 | return 0; |
227 | 223 | ||
228 | if (*count != -1) | 224 | if (*count != -1) |
229 | (*count)--; | 225 | (*count)--; |
230 | 226 | ||
231 | tracing_on(); | 227 | return 1; |
232 | } | 228 | } |
233 | 229 | ||
234 | static void | 230 | static void |
235 | ftrace_traceoff(unsigned long ip, unsigned long parent_ip, void **data) | 231 | ftrace_traceon(unsigned long ip, unsigned long parent_ip, void **data) |
236 | { | 232 | { |
237 | long *count = (long *)data; | 233 | if (tracing_is_on()) |
238 | |||
239 | if (!tracing_is_on()) | ||
240 | return; | 234 | return; |
241 | 235 | ||
242 | if (!*count) | 236 | if (update_count(data)) |
243 | return; | 237 | tracing_on(); |
238 | } | ||
244 | 239 | ||
245 | if (*count != -1) | 240 | static void |
246 | (*count)--; | 241 | ftrace_traceoff(unsigned long ip, unsigned long parent_ip, void **data) |
242 | { | ||
243 | if (!tracing_is_on()) | ||
244 | return; | ||
247 | 245 | ||
248 | tracing_off(); | 246 | if (update_count(data)) |
247 | tracing_off(); | ||
249 | } | 248 | } |
250 | 249 | ||
251 | static int | 250 | static int |