aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ftrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r--kernel/trace/ftrace.c44
1 files changed, 11 insertions, 33 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 0fa92f677c92..cf81f27ce6c6 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2469,57 +2469,35 @@ static int
2469ftrace_avail_open(struct inode *inode, struct file *file) 2469ftrace_avail_open(struct inode *inode, struct file *file)
2470{ 2470{
2471 struct ftrace_iterator *iter; 2471 struct ftrace_iterator *iter;
2472 int ret;
2473 2472
2474 if (unlikely(ftrace_disabled)) 2473 if (unlikely(ftrace_disabled))
2475 return -ENODEV; 2474 return -ENODEV;
2476 2475
2477 iter = kzalloc(sizeof(*iter), GFP_KERNEL); 2476 iter = __seq_open_private(file, &show_ftrace_seq_ops, sizeof(*iter));
2478 if (!iter) 2477 if (iter) {
2479 return -ENOMEM; 2478 iter->pg = ftrace_pages_start;
2480 2479 iter->ops = &global_ops;
2481 iter->pg = ftrace_pages_start;
2482 iter->ops = &global_ops;
2483
2484 ret = seq_open(file, &show_ftrace_seq_ops);
2485 if (!ret) {
2486 struct seq_file *m = file->private_data;
2487
2488 m->private = iter;
2489 } else {
2490 kfree(iter);
2491 } 2480 }
2492 2481
2493 return ret; 2482 return iter ? 0 : -ENOMEM;
2494} 2483}
2495 2484
2496static int 2485static int
2497ftrace_enabled_open(struct inode *inode, struct file *file) 2486ftrace_enabled_open(struct inode *inode, struct file *file)
2498{ 2487{
2499 struct ftrace_iterator *iter; 2488 struct ftrace_iterator *iter;
2500 int ret;
2501 2489
2502 if (unlikely(ftrace_disabled)) 2490 if (unlikely(ftrace_disabled))
2503 return -ENODEV; 2491 return -ENODEV;
2504 2492
2505 iter = kzalloc(sizeof(*iter), GFP_KERNEL); 2493 iter = __seq_open_private(file, &show_ftrace_seq_ops, sizeof(*iter));
2506 if (!iter) 2494 if (iter) {
2507 return -ENOMEM; 2495 iter->pg = ftrace_pages_start;
2508 2496 iter->flags = FTRACE_ITER_ENABLED;
2509 iter->pg = ftrace_pages_start; 2497 iter->ops = &global_ops;
2510 iter->flags = FTRACE_ITER_ENABLED;
2511 iter->ops = &global_ops;
2512
2513 ret = seq_open(file, &show_ftrace_seq_ops);
2514 if (!ret) {
2515 struct seq_file *m = file->private_data;
2516
2517 m->private = iter;
2518 } else {
2519 kfree(iter);
2520 } 2498 }
2521 2499
2522 return ret; 2500 return iter ? 0 : -ENOMEM;
2523} 2501}
2524 2502
2525static void ftrace_filter_reset(struct ftrace_hash *hash) 2503static void ftrace_filter_reset(struct ftrace_hash *hash)