diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-11-23 05:37:23 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-23 05:49:55 -0500 |
commit | a66a3052e2d4c5815d7ad26887b1d4193206e691 (patch) | |
tree | 4f8043ef4bccf3779b5d7d180d82cf18f451e025 /kernel/perf_event.c | |
parent | a4234bfcf4d72a10a99176cdef007345e9c3b4aa (diff) |
perf_events: Undo copy/paste damage
We had two almost identical functions, avoid the duplication.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <20091123103819.537537928@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r-- | kernel/perf_event.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 20df8aba8da5..e2daa10bb5ce 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -1704,16 +1704,10 @@ static void free_event(struct perf_event *event) | |||
1704 | call_rcu(&event->rcu_head, free_event_rcu); | 1704 | call_rcu(&event->rcu_head, free_event_rcu); |
1705 | } | 1705 | } |
1706 | 1706 | ||
1707 | /* | 1707 | int perf_event_release_kernel(struct perf_event *event) |
1708 | * Called when the last reference to the file is gone. | ||
1709 | */ | ||
1710 | static int perf_release(struct inode *inode, struct file *file) | ||
1711 | { | 1708 | { |
1712 | struct perf_event *event = file->private_data; | ||
1713 | struct perf_event_context *ctx = event->ctx; | 1709 | struct perf_event_context *ctx = event->ctx; |
1714 | 1710 | ||
1715 | file->private_data = NULL; | ||
1716 | |||
1717 | WARN_ON_ONCE(ctx->parent_ctx); | 1711 | WARN_ON_ONCE(ctx->parent_ctx); |
1718 | mutex_lock(&ctx->mutex); | 1712 | mutex_lock(&ctx->mutex); |
1719 | perf_event_remove_from_context(event); | 1713 | perf_event_remove_from_context(event); |
@@ -1728,26 +1722,19 @@ static int perf_release(struct inode *inode, struct file *file) | |||
1728 | 1722 | ||
1729 | return 0; | 1723 | return 0; |
1730 | } | 1724 | } |
1725 | EXPORT_SYMBOL_GPL(perf_event_release_kernel); | ||
1731 | 1726 | ||
1732 | int perf_event_release_kernel(struct perf_event *event) | 1727 | /* |
1728 | * Called when the last reference to the file is gone. | ||
1729 | */ | ||
1730 | static int perf_release(struct inode *inode, struct file *file) | ||
1733 | { | 1731 | { |
1734 | struct perf_event_context *ctx = event->ctx; | 1732 | struct perf_event *event = file->private_data; |
1735 | |||
1736 | WARN_ON_ONCE(ctx->parent_ctx); | ||
1737 | mutex_lock(&ctx->mutex); | ||
1738 | perf_event_remove_from_context(event); | ||
1739 | mutex_unlock(&ctx->mutex); | ||
1740 | |||
1741 | mutex_lock(&event->owner->perf_event_mutex); | ||
1742 | list_del_init(&event->owner_entry); | ||
1743 | mutex_unlock(&event->owner->perf_event_mutex); | ||
1744 | put_task_struct(event->owner); | ||
1745 | 1733 | ||
1746 | free_event(event); | 1734 | file->private_data = NULL; |
1747 | 1735 | ||
1748 | return 0; | 1736 | return perf_event_release_kernel(event); |
1749 | } | 1737 | } |
1750 | EXPORT_SYMBOL_GPL(perf_event_release_kernel); | ||
1751 | 1738 | ||
1752 | static int perf_event_read_size(struct perf_event *event) | 1739 | static int perf_event_read_size(struct perf_event *event) |
1753 | { | 1740 | { |