aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Rutland <[email protected]>2022-09-30 12:18:43 +0100
committerWill Deacon <[email protected]>2022-11-07 16:16:20 +0000
commit6349a2470d07561bc25e34681985c6ff9c807dfb (patch)
tree391462fc8667872612058b49dfaf032a8ad6405c
parentad51b5043bb39e0d715e8ad910fa5ac899ebc70b (diff)
arm_pmu: factor out PMU matching
A subsequent patch will rework the ACPI probing of PMUs, and we'll need to match a CPU with a known cpuid in two separate paths. Factor out the matching logic into a helper function so that it can be reused. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <[email protected]> Cc: Pierre Gondois <[email protected]> Cc: Will Deacon <[email protected]> Reviewed-and-tested-by: Pierre Gondois <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
-rw-r--r--drivers/perf/arm_pmu_acpi.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c
index a52a4aafd629..99abea3b2cc9 100644
--- a/drivers/perf/arm_pmu_acpi.c
+++ b/drivers/perf/arm_pmu_acpi.c
@@ -187,7 +187,7 @@ out_err:
return err;
}
-static struct arm_pmu *arm_pmu_acpi_find_alloc_pmu(void)
+static struct arm_pmu *arm_pmu_acpi_find_pmu(void)
{
unsigned long cpuid = read_cpuid_id();
struct arm_pmu *pmu;
@@ -201,6 +201,17 @@ static struct arm_pmu *arm_pmu_acpi_find_alloc_pmu(void)
return pmu;
}
+ return NULL;
+}
+
+static struct arm_pmu *arm_pmu_acpi_find_alloc_pmu(void)
+{
+ struct arm_pmu *pmu;
+
+ pmu = arm_pmu_acpi_find_pmu();
+ if (pmu)
+ return pmu;
+
pmu = armpmu_alloc_atomic();
if (!pmu) {
pr_warn("Unable to allocate PMU for CPU%d\n",
@@ -208,7 +219,7 @@ static struct arm_pmu *arm_pmu_acpi_find_alloc_pmu(void)
return NULL;
}
- pmu->acpi_cpuid = cpuid;
+ pmu->acpi_cpuid = read_cpuid_id();
return pmu;
}