summaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/perf_event.c
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2011-08-23 11:59:49 +0100
committerWill Deacon <will.deacon@arm.com>2011-08-31 10:50:13 +0100
commit7325eaec439cd0cc8c9b61b59d41d99abace1b23 (patch)
tree802b05381659791a59db17827702f60202a4afbd /arch/arm/kernel/perf_event.c
parent0ce47080dfffe71edd433b35dcdada24c61079eb (diff)
downloadtalos-obmc-linux-7325eaec439cd0cc8c9b61b59d41d99abace1b23.tar.gz
talos-obmc-linux-7325eaec439cd0cc8c9b61b59d41d99abace1b23.zip
ARM: perf: Remove unnecessary armpmu->enable()s
Currently, armpmu_enable iterates through the events for a given counter set, calling armpmu->enable on each before calling armpmu->start to start the PMU's counters. As armpmu->enable is called when each event is added, each event is already configured in hardware. Due to this, calling armpmu->enable in armpmu_enable is unnecessary and confusing. This patch removes the unnecessary calls to armpmu->enable. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm/kernel/perf_event.c')
-rw-r--r--arch/arm/kernel/perf_event.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index aaa631b8cbc2..e6e5d7c84f1a 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -12,6 +12,7 @@
*/
#define pr_fmt(fmt) "hw perfevents: " fmt
+#include <linux/bitmap.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
@@ -557,20 +558,9 @@ static int armpmu_event_init(struct perf_event *event)
static void armpmu_enable(struct pmu *pmu)
{
- /* Enable all of the perf events on hardware. */
struct arm_pmu *armpmu = to_arm_pmu(pmu);
- int idx, enabled = 0;
struct pmu_hw_events *hw_events = armpmu->get_hw_events();
-
- for (idx = 0; idx < armpmu->num_events; ++idx) {
- struct perf_event *event = hw_events->events[idx];
-
- if (!event)
- continue;
-
- armpmu->enable(&event->hw, idx);
- enabled = 1;
- }
+ int enabled = bitmap_weight(hw_events->used_mask, armpmu->num_events);
if (enabled)
armpmu->start();
OpenPOWER on IntegriCloud