aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2011-05-04 04:23:15 -0400
committerWill Deacon <will.deacon@arm.com>2011-08-31 05:50:04 -0400
commita9356a04fab912289b886824cb4b1d461987a910 (patch)
tree786f8b29224b3039a856fd87765f3f116d84e500 /arch
parent03b7898d300de62078cc130fbc83b84b1d1e0f8d (diff)
ARM: perf: move platform device to struct arm_pmu
Currently the ARM perf code supports having a single struct platform_device to supply IRQ numbers, limiting it to supporting a single PMU. This patch makes a platform_device instance variable on struct arm_pmu. This should allow for multiple PMUs to be supported in future. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Will Deacon <will.deacon@arm.com> Reviewed-by: Jamie Iles <jamie@jamieiles.com> Reviewed-by: Ashwin Chaugule <ashwinc@codeaurora.org> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/perf_event.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 9874395e7e7a..1d648d136413 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -26,8 +26,6 @@
26#include <asm/pmu.h> 26#include <asm/pmu.h>
27#include <asm/stacktrace.h> 27#include <asm/stacktrace.h>
28 28
29static struct platform_device *pmu_device;
30
31/* 29/*
32 * Hardware lock to serialize accesses to PMU registers. Needed for the 30 * Hardware lock to serialize accesses to PMU registers. Needed for the
33 * read/modify/write sequences. 31 * read/modify/write sequences.
@@ -85,6 +83,7 @@ struct arm_pmu {
85 atomic_t active_events; 83 atomic_t active_events;
86 struct mutex reserve_mutex; 84 struct mutex reserve_mutex;
87 u64 max_period; 85 u64 max_period;
86 struct platform_device *plat_device;
88}; 87};
89 88
90/* Set at runtime when we know what CPU type we are. */ 89/* Set at runtime when we know what CPU type we are. */
@@ -374,7 +373,8 @@ validate_group(struct perf_event *event)
374 373
375static irqreturn_t armpmu_platform_irq(int irq, void *dev) 374static irqreturn_t armpmu_platform_irq(int irq, void *dev)
376{ 375{
377 struct arm_pmu_platdata *plat = dev_get_platdata(&pmu_device->dev); 376 struct platform_device *plat_device = armpmu->plat_device;
377 struct arm_pmu_platdata *plat = dev_get_platdata(&plat_device->dev);
378 378
379 return plat->handle_irq(irq, dev, armpmu->handle_irq); 379 return plat->handle_irq(irq, dev, armpmu->handle_irq);
380} 380}
@@ -383,6 +383,7 @@ static void
383armpmu_release_hardware(void) 383armpmu_release_hardware(void)
384{ 384{
385 int i, irq, irqs; 385 int i, irq, irqs;
386 struct platform_device *pmu_device = armpmu->plat_device;
386 387
387 irqs = min(pmu_device->num_resources, num_possible_cpus()); 388 irqs = min(pmu_device->num_resources, num_possible_cpus());
388 389
@@ -404,6 +405,7 @@ armpmu_reserve_hardware(void)
404 struct arm_pmu_platdata *plat; 405 struct arm_pmu_platdata *plat;
405 irq_handler_t handle_irq; 406 irq_handler_t handle_irq;
406 int i, err, irq, irqs; 407 int i, err, irq, irqs;
408 struct platform_device *pmu_device = armpmu->plat_device;
407 409
408 err = reserve_pmu(ARM_PMU_DEVICE_CPU); 410 err = reserve_pmu(ARM_PMU_DEVICE_CPU);
409 if (err) { 411 if (err) {
@@ -657,7 +659,7 @@ static struct platform_device_id armpmu_plat_device_ids[] = {
657 659
658static int __devinit armpmu_device_probe(struct platform_device *pdev) 660static int __devinit armpmu_device_probe(struct platform_device *pdev)
659{ 661{
660 pmu_device = pdev; 662 armpmu->plat_device = pdev;
661 return 0; 663 return 0;
662} 664}
663 665