aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_functions.c
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2013-03-09 08:36:53 -0500
committerSteven Rostedt <rostedt@goodmis.org>2013-03-15 00:35:58 -0400
commit1c31714328be90764e46716f31fb0bd6da44c305 (patch)
tree749d35b272ef7bc5f7c1ee84070d23afe2b425a5 /kernel/trace/trace_functions.c
parent1b22e382ab40b0e3ee5abb3e310dffb16fee22aa (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>
Diffstat (limited to 'kernel/trace/trace_functions.c')
-rw-r--r--kernel/trace/trace_functions.c33
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
217static void 217static int update_count(void **data)
218ftrace_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
234static void 230static void
235ftrace_traceoff(unsigned long ip, unsigned long parent_ip, void **data) 231ftrace_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) 240static void
246 (*count)--; 241ftrace_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
251static int 250static int