diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-09-18 02:06:28 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-09-19 11:26:54 -0400 |
commit | a4ec5e0c2681b8cf99ddabf118705847f7460f19 (patch) | |
tree | d345e9d6037d7652184b780f49f31e19eba61061 | |
parent | 0efb4d20723d58edbad29d1ff98a86b631adb5e6 (diff) |
function-graph: use ftrace_graph_funcs directly
No need to store ftrace_graph_funcs in file->private.
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4AB32364.7020602@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | kernel/trace/ftrace.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index cc615f84751b..c71e91bf7372 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -2414,11 +2414,9 @@ unsigned long ftrace_graph_funcs[FTRACE_GRAPH_MAX_FUNCS] __read_mostly; | |||
2414 | static void * | 2414 | static void * |
2415 | __g_next(struct seq_file *m, loff_t *pos) | 2415 | __g_next(struct seq_file *m, loff_t *pos) |
2416 | { | 2416 | { |
2417 | unsigned long *array = m->private; | ||
2418 | |||
2419 | if (*pos >= ftrace_graph_count) | 2417 | if (*pos >= ftrace_graph_count) |
2420 | return NULL; | 2418 | return NULL; |
2421 | return &array[*pos]; | 2419 | return &ftrace_graph_funcs[*pos]; |
2422 | } | 2420 | } |
2423 | 2421 | ||
2424 | static void * | 2422 | static void * |
@@ -2482,16 +2480,10 @@ ftrace_graph_open(struct inode *inode, struct file *file) | |||
2482 | ftrace_graph_count = 0; | 2480 | ftrace_graph_count = 0; |
2483 | memset(ftrace_graph_funcs, 0, sizeof(ftrace_graph_funcs)); | 2481 | memset(ftrace_graph_funcs, 0, sizeof(ftrace_graph_funcs)); |
2484 | } | 2482 | } |
2483 | mutex_unlock(&graph_lock); | ||
2485 | 2484 | ||
2486 | if (file->f_mode & FMODE_READ) { | 2485 | if (file->f_mode & FMODE_READ) |
2487 | ret = seq_open(file, &ftrace_graph_seq_ops); | 2486 | ret = seq_open(file, &ftrace_graph_seq_ops); |
2488 | if (!ret) { | ||
2489 | struct seq_file *m = file->private_data; | ||
2490 | m->private = ftrace_graph_funcs; | ||
2491 | } | ||
2492 | } else | ||
2493 | file->private_data = ftrace_graph_funcs; | ||
2494 | mutex_unlock(&graph_lock); | ||
2495 | 2487 | ||
2496 | return ret; | 2488 | return ret; |
2497 | } | 2489 | } |
@@ -2560,7 +2552,6 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, | |||
2560 | size_t cnt, loff_t *ppos) | 2552 | size_t cnt, loff_t *ppos) |
2561 | { | 2553 | { |
2562 | struct trace_parser parser; | 2554 | struct trace_parser parser; |
2563 | unsigned long *array; | ||
2564 | size_t read = 0; | 2555 | size_t read = 0; |
2565 | ssize_t ret; | 2556 | ssize_t ret; |
2566 | 2557 | ||
@@ -2574,12 +2565,6 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, | |||
2574 | goto out; | 2565 | goto out; |
2575 | } | 2566 | } |
2576 | 2567 | ||
2577 | if (file->f_mode & FMODE_READ) { | ||
2578 | struct seq_file *m = file->private_data; | ||
2579 | array = m->private; | ||
2580 | } else | ||
2581 | array = file->private_data; | ||
2582 | |||
2583 | if (trace_parser_get_init(&parser, FTRACE_BUFF_MAX)) { | 2568 | if (trace_parser_get_init(&parser, FTRACE_BUFF_MAX)) { |
2584 | ret = -ENOMEM; | 2569 | ret = -ENOMEM; |
2585 | goto out; | 2570 | goto out; |
@@ -2591,7 +2576,7 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, | |||
2591 | parser.buffer[parser.idx] = 0; | 2576 | parser.buffer[parser.idx] = 0; |
2592 | 2577 | ||
2593 | /* we allow only one expression at a time */ | 2578 | /* we allow only one expression at a time */ |
2594 | ret = ftrace_set_func(array, &ftrace_graph_count, | 2579 | ret = ftrace_set_func(ftrace_graph_funcs, &ftrace_graph_count, |
2595 | parser.buffer); | 2580 | parser.buffer); |
2596 | if (ret) | 2581 | if (ret) |
2597 | goto out; | 2582 | goto out; |