Commit a66a3052 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

perf_events: Undo copy/paste damage

We had two almost identical functions, avoid the duplication.
Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
parent a4234bfc
...@@ -1704,16 +1704,10 @@ static void free_event(struct perf_event *event) ...@@ -1704,16 +1704,10 @@ static void free_event(struct perf_event *event)
call_rcu(&event->rcu_head, free_event_rcu); call_rcu(&event->rcu_head, free_event_rcu);
} }
/* int perf_event_release_kernel(struct perf_event *event)
* Called when the last reference to the file is gone.
*/
static int perf_release(struct inode *inode, struct file *file)
{ {
struct perf_event *event = file->private_data;
struct perf_event_context *ctx = event->ctx; struct perf_event_context *ctx = event->ctx;
file->private_data = NULL;
WARN_ON_ONCE(ctx->parent_ctx); WARN_ON_ONCE(ctx->parent_ctx);
mutex_lock(&ctx->mutex); mutex_lock(&ctx->mutex);
perf_event_remove_from_context(event); perf_event_remove_from_context(event);
...@@ -1728,26 +1722,19 @@ static int perf_release(struct inode *inode, struct file *file) ...@@ -1728,26 +1722,19 @@ static int perf_release(struct inode *inode, struct file *file)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(perf_event_release_kernel);
int perf_event_release_kernel(struct perf_event *event) /*
* Called when the last reference to the file is gone.
*/
static int perf_release(struct inode *inode, struct file *file)
{ {
struct perf_event_context *ctx = event->ctx; struct perf_event *event = file->private_data;
WARN_ON_ONCE(ctx->parent_ctx);
mutex_lock(&ctx->mutex);
perf_event_remove_from_context(event);
mutex_unlock(&ctx->mutex);
mutex_lock(&event->owner->perf_event_mutex);
list_del_init(&event->owner_entry);
mutex_unlock(&event->owner->perf_event_mutex);
put_task_struct(event->owner);
free_event(event); file->private_data = NULL;
return 0; return perf_event_release_kernel(event);
} }
EXPORT_SYMBOL_GPL(perf_event_release_kernel);
static int perf_event_read_size(struct perf_event *event) static int perf_event_read_size(struct perf_event *event)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment