diff options
| -rw-r--r-- | kernel/trace/trace_events.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 8be1224046f8..7a0cf68027cc 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
| @@ -1529,6 +1529,24 @@ __register_event(struct ftrace_event_call *call, struct module *mod) | |||
| 1529 | return 0; | 1529 | return 0; |
| 1530 | } | 1530 | } |
| 1531 | 1531 | ||
| 1532 | static struct ftrace_event_file * | ||
| 1533 | trace_create_new_event(struct ftrace_event_call *call, | ||
| 1534 | struct trace_array *tr) | ||
| 1535 | { | ||
| 1536 | struct ftrace_event_file *file; | ||
| 1537 | |||
| 1538 | file = kmem_cache_alloc(file_cachep, GFP_TRACE); | ||
| 1539 | if (!file) | ||
| 1540 | return NULL; | ||
| 1541 | |||
| 1542 | file->event_call = call; | ||
| 1543 | file->tr = tr; | ||
| 1544 | atomic_set(&file->sm_ref, 0); | ||
| 1545 | list_add(&file->list, &tr->events); | ||
| 1546 | |||
| 1547 | return file; | ||
| 1548 | } | ||
| 1549 | |||
| 1532 | /* Add an event to a trace directory */ | 1550 | /* Add an event to a trace directory */ |
| 1533 | static int | 1551 | static int |
| 1534 | __trace_add_new_event(struct ftrace_event_call *call, | 1552 | __trace_add_new_event(struct ftrace_event_call *call, |
| @@ -1540,15 +1558,10 @@ __trace_add_new_event(struct ftrace_event_call *call, | |||
| 1540 | { | 1558 | { |
| 1541 | struct ftrace_event_file *file; | 1559 | struct ftrace_event_file *file; |
| 1542 | 1560 | ||
| 1543 | file = kmem_cache_alloc(file_cachep, GFP_TRACE); | 1561 | file = trace_create_new_event(call, tr); |
| 1544 | if (!file) | 1562 | if (!file) |
| 1545 | return -ENOMEM; | 1563 | return -ENOMEM; |
| 1546 | 1564 | ||
| 1547 | file->event_call = call; | ||
| 1548 | file->tr = tr; | ||
| 1549 | atomic_set(&file->sm_ref, 0); | ||
| 1550 | list_add(&file->list, &tr->events); | ||
| 1551 | |||
| 1552 | return event_create_dir(tr->event_dir, file, id, enable, filter, format); | 1565 | return event_create_dir(tr->event_dir, file, id, enable, filter, format); |
| 1553 | } | 1566 | } |
| 1554 | 1567 | ||
| @@ -1563,15 +1576,10 @@ __trace_early_add_new_event(struct ftrace_event_call *call, | |||
| 1563 | { | 1576 | { |
| 1564 | struct ftrace_event_file *file; | 1577 | struct ftrace_event_file *file; |
| 1565 | 1578 | ||
| 1566 | file = kmem_cache_alloc(file_cachep, GFP_TRACE); | 1579 | file = trace_create_new_event(call, tr); |
| 1567 | if (!file) | 1580 | if (!file) |
| 1568 | return -ENOMEM; | 1581 | return -ENOMEM; |
| 1569 | 1582 | ||
| 1570 | file->event_call = call; | ||
| 1571 | file->tr = tr; | ||
| 1572 | atomic_set(&file->sm_ref, 0); | ||
| 1573 | list_add(&file->list, &tr->events); | ||
| 1574 | |||
| 1575 | return 0; | 1583 | return 0; |
| 1576 | } | 1584 | } |
| 1577 | 1585 | ||
