diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-06-11 07:35:08 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-09-09 14:46:28 -0400 |
commit | b0a873ebbf87bf38bf70b5e39a7cadc96099fa13 (patch) | |
tree | 63ab672b847aed295f99b9b2a3bbcfd5d3d35bd9 /arch/alpha/kernel/perf_event.c | |
parent | 51b0fe39549a04858001922919ab355dee9bdfcf (diff) |
perf: Register PMU implementations
Simple registration interface for struct pmu, this provides the
infrastructure for removing all the weak functions.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
Cc: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
Cc: David Miller <davem@davemloft.net>
Cc: Michael Cree <mcree@orcon.net.nz>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/alpha/kernel/perf_event.c')
-rw-r--r-- | arch/alpha/kernel/perf_event.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c index 56fa41590381..19660b5c298f 100644 --- a/arch/alpha/kernel/perf_event.c +++ b/arch/alpha/kernel/perf_event.c | |||
@@ -642,34 +642,39 @@ static int __hw_perf_event_init(struct perf_event *event) | |||
642 | return 0; | 642 | return 0; |
643 | } | 643 | } |
644 | 644 | ||
645 | static struct pmu pmu = { | ||
646 | .enable = alpha_pmu_enable, | ||
647 | .disable = alpha_pmu_disable, | ||
648 | .read = alpha_pmu_read, | ||
649 | .unthrottle = alpha_pmu_unthrottle, | ||
650 | }; | ||
651 | |||
652 | |||
653 | /* | 645 | /* |
654 | * Main entry point to initialise a HW performance event. | 646 | * Main entry point to initialise a HW performance event. |
655 | */ | 647 | */ |
656 | struct pmu *hw_perf_event_init(struct perf_event *event) | 648 | static int alpha_pmu_event_init(struct perf_event *event) |
657 | { | 649 | { |
658 | int err; | 650 | int err; |
659 | 651 | ||
652 | switch (event->attr.type) { | ||
653 | case PERF_TYPE_RAW: | ||
654 | case PERF_TYPE_HARDWARE: | ||
655 | case PERF_TYPE_HW_CACHE: | ||
656 | break; | ||
657 | |||
658 | default: | ||
659 | return -ENOENT; | ||
660 | } | ||
661 | |||
660 | if (!alpha_pmu) | 662 | if (!alpha_pmu) |
661 | return ERR_PTR(-ENODEV); | 663 | return -ENODEV; |
662 | 664 | ||
663 | /* Do the real initialisation work. */ | 665 | /* Do the real initialisation work. */ |
664 | err = __hw_perf_event_init(event); | 666 | err = __hw_perf_event_init(event); |
665 | 667 | ||
666 | if (err) | 668 | return err; |
667 | return ERR_PTR(err); | ||
668 | |||
669 | return &pmu; | ||
670 | } | 669 | } |
671 | 670 | ||
672 | 671 | static struct pmu pmu = { | |
672 | .event_init = alpha_pmu_event_init, | ||
673 | .enable = alpha_pmu_enable, | ||
674 | .disable = alpha_pmu_disable, | ||
675 | .read = alpha_pmu_read, | ||
676 | .unthrottle = alpha_pmu_unthrottle, | ||
677 | }; | ||
673 | 678 | ||
674 | /* | 679 | /* |
675 | * Main entry point - enable HW performance counters. | 680 | * Main entry point - enable HW performance counters. |
@@ -838,5 +843,7 @@ void __init init_hw_perf_events(void) | |||
838 | /* And set up PMU specification */ | 843 | /* And set up PMU specification */ |
839 | alpha_pmu = &ev67_pmu; | 844 | alpha_pmu = &ev67_pmu; |
840 | perf_max_events = alpha_pmu->num_pmcs; | 845 | perf_max_events = alpha_pmu->num_pmcs; |
846 | |||
847 | perf_pmu_register(&pmu); | ||
841 | } | 848 | } |
842 | 849 | ||