aboutsummaryrefslogtreecommitdiff
path: root/driver/gator_ebs.c
diff options
context:
space:
mode:
authorPawel Moll <pawel.moll@arm.com>2011-11-17 18:14:03 +0000
committerPawel Moll <pawel.moll@arm.com>2011-11-17 18:14:03 +0000
commit6d51ed1aa2f14b8ee097e940a4d747bf04020195 (patch)
tree5fb49aff4be9956cfdb58dfe9e4129a86130d292 /driver/gator_ebs.c
parent3081bf8f00d4b17641988db512efd8828f59eb05 (diff)
gator-driver: ARM DS-5.8 Streamline gator driver (RC1)DS-5.8
Diffstat (limited to 'driver/gator_ebs.c')
-rw-r--r--driver/gator_ebs.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/driver/gator_ebs.c b/driver/gator_ebs.c
index 9b55347..8b4b5ff 100644
--- a/driver/gator_ebs.c
+++ b/driver/gator_ebs.c
@@ -95,16 +95,19 @@ static int gator_event_sampling_start(void)
int irq, i;
if (IS_ERR(pmu_device)) {
- pr_err("gator: event based sampling is not supported as the kernel function reserve_pmu() failed");
+ pr_err("gator: event based sampling is not supported as the kernel function reserve_pmu() failed\n");
return -1;
}
- init_pmu(ARM_PMU_DEVICE_CPU);
+ // init_pmu sets the irq affinity, therefore we do not care if it fails for single core
+ if (init_pmu(ARM_PMU_DEVICE_CPU) != 0 && gator_cpu_cores > 1) {
+ pr_err("gator: unable to initialize the pmu\n");
+ goto out_ebs_start;
+ }
+
if (pmu_device->num_resources == 0) {
pr_err("gator: no irqs for PMUs defined\n");
- release_pmu(pmu_device);
- pmu_device = NULL;
- return -1;
+ goto out_ebs_start;
}
for (i = 0; i < pmu_device->num_resources; ++i) {
@@ -121,9 +124,7 @@ static int gator_event_sampling_start(void)
if (irq >= 0)
free_irq(irq, NULL);
}
- release_pmu(pmu_device);
- pmu_device = NULL;
- return -1;
+ goto out_ebs_start;
}
}
}
@@ -135,6 +136,17 @@ static int gator_event_sampling_start(void)
#endif
return 0;
+
+#if LINUX_PMU_SUPPORT
+out_ebs_start:
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0)
+ release_pmu(pmu_device);
+#else
+ release_pmu(ARM_PMU_DEVICE_CPU);
+#endif
+ pmu_device = NULL;
+ return -1;
+#endif
}
static void gator_event_sampling_stop(void)
@@ -148,8 +160,13 @@ static void gator_event_sampling_stop(void)
free_irq(irq, NULL);
}
}
- if (!IS_ERR(pmu_device))
+ if (!IS_ERR(pmu_device)) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0)
release_pmu(pmu_device);
+#else
+ release_pmu(ARM_PMU_DEVICE_CPU);
+#endif
+ }
pmu_device = NULL;
#endif
}