* [RFC][PATCH 4/9] perf: x86, convert to new API pmu->init_event
@ 2010-05-10 9:27 Lin Ming
0 siblings, 0 replies; only message in thread
From: Lin Ming @ 2010-05-10 9:27 UTC (permalink / raw
To: Peter Zijlstra, Ingo Molnar
Cc: Frederic Weisbecker, eranian@gmail.com, Gary.Mohr@Bull.com,
Corey Ashford, arjan@linux.intel.com, Zhang, Yanmin,
Paul Mackerras, David S. Miller, Russell King, Paul Mundt, lkml
perf: x86, convert to new API pmu->init_event
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
---
arch/x86/kernel/cpu/perf_event.c | 32 +++++++++++++++++---------------
1 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 5c6a0d9..2c3cc46 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1362,6 +1362,8 @@ void __init init_hw_perf_events(void)
pr_info("... event mask: %016Lx\n", x86_pmu.intel_ctrl);
perf_cpu_notifier(x86_pmu_notifier);
+
+ perf_event_register_pmu(&pmu);
}
static inline void x86_pmu_read(struct perf_event *event)
@@ -1422,18 +1424,6 @@ static int x86_pmu_commit_txn(struct pmu *pmu)
return 0;
}
-static struct pmu pmu = {
- .enable = x86_pmu_enable,
- .disable = x86_pmu_disable,
- .start = x86_pmu_start,
- .stop = x86_pmu_stop,
- .read = x86_pmu_read,
- .unthrottle = x86_pmu_unthrottle,
- .start_txn = x86_pmu_start_txn,
- .cancel_txn = x86_pmu_cancel_txn,
- .commit_txn = x86_pmu_commit_txn,
-};
-
/*
* validate that we can schedule this event
*/
@@ -1508,7 +1498,7 @@ out:
return ret;
}
-struct pmu *hw_perf_event_init(struct perf_event *event)
+static int x86_pmu_init_event(struct perf_event *event)
{
struct pmu *tmp;
int err;
@@ -1533,12 +1523,24 @@ struct pmu *hw_perf_event_init(struct perf_event *event)
if (err) {
if (event->destroy)
event->destroy(event);
- return ERR_PTR(err);
}
- return &pmu;
+ return err;
}
+static struct pmu pmu = {
+ .enable = x86_pmu_enable,
+ .disable = x86_pmu_disable,
+ .start = x86_pmu_start,
+ .stop = x86_pmu_stop,
+ .read = x86_pmu_read,
+ .unthrottle = x86_pmu_unthrottle,
+ .start_txn = x86_pmu_start_txn,
+ .cancel_txn = x86_pmu_cancel_txn,
+ .commit_txn = x86_pmu_commit_txn,
+ .init_event = x86_pmu_init_event,
+};
+
/*
* callchain support
*/
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-05-10 9:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-10 9:27 [RFC][PATCH 4/9] perf: x86, convert to new API pmu->init_event Lin Ming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).