lkml.org 
[lkml]   [2010]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[RFC][PATCH v2 04/11] perf: core, use new api to lookup pmu and init event
From
Date
Remove the weak function hw_perf_event_init

Signed-off-by: Lin Ming <ming.m.lin@intel.com>
---
include/linux/perf_event.h | 2 --
kernel/perf_event.c | 12 ++++--------
2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 40809f5..ad2aea3 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -825,8 +825,6 @@ struct perf_output_handle {
*/
extern int perf_max_events;

-extern struct pmu *hw_perf_event_init(struct perf_event *event);
-
extern void perf_event_task_sched_in(struct task_struct *task);
extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next);
extern void perf_event_task_tick(struct task_struct *task);
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 31b032b..17eff7b 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -81,11 +81,6 @@ static DEFINE_SPINLOCK(perf_resource_lock);
/*
* Architecture provided APIs - weak aliases:
*/
-extern __weak struct pmu *hw_perf_event_init(struct perf_event *event)
-{
- return NULL;
-}
-
void __weak hw_perf_disable(void) { barrier(); }
void __weak hw_perf_enable(void) { barrier(); }

@@ -4727,7 +4722,7 @@ perf_event_alloc(struct perf_event_attr *attr,
struct pmu *pmu;
struct perf_event *event;
struct hw_perf_event *hwc;
- long err;
+ long err = 0;

event = kzalloc(sizeof(*event), gfpflags);
if (!event)
@@ -4792,7 +4787,9 @@ perf_event_alloc(struct perf_event_attr *attr,
case PERF_TYPE_RAW:
case PERF_TYPE_HARDWARE:
case PERF_TYPE_HW_CACHE:
- pmu = hw_perf_event_init(event);
+ pmu = perf_event_lookup_pmu(event);
+ if (pmu && pmu->init_event)
+ err = pmu->init_event(event);
break;

case PERF_TYPE_SOFTWARE:
@@ -4812,7 +4809,6 @@ perf_event_alloc(struct perf_event_attr *attr,
break;
}
done:
- err = 0;
if (!pmu)
err = -EINVAL;
else if (IS_ERR(pmu))





\
 
 \ /
  Last update: 2010-05-18 19:49    [W:0.019 / U:8.468 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site