Commit 6349a247 authored by Mark Rutland's avatar Mark Rutland Committed by Will Deacon

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: default avatarMark Rutland <mark.rutland@arm.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Cc: Will Deacon <will@kernel.org>
Reviewed-and-tested-by: default avatarPierre Gondois <pierre.gondois@arm.com>
Link: https://lore.kernel.org/r/20220930111844.1522365-3-mark.rutland@arm.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
parent ad51b504
...@@ -187,7 +187,7 @@ static int arm_pmu_acpi_parse_irqs(void) ...@@ -187,7 +187,7 @@ static int arm_pmu_acpi_parse_irqs(void)
return 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(); unsigned long cpuid = read_cpuid_id();
struct arm_pmu *pmu; struct arm_pmu *pmu;
...@@ -201,6 +201,17 @@ static struct arm_pmu *arm_pmu_acpi_find_alloc_pmu(void) ...@@ -201,6 +201,17 @@ static struct arm_pmu *arm_pmu_acpi_find_alloc_pmu(void)
return pmu; 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(); pmu = armpmu_alloc_atomic();
if (!pmu) { if (!pmu) {
pr_warn("Unable to allocate PMU for CPU%d\n", 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) ...@@ -208,7 +219,7 @@ static struct arm_pmu *arm_pmu_acpi_find_alloc_pmu(void)
return NULL; return NULL;
} }
pmu->acpi_cpuid = cpuid; pmu->acpi_cpuid = read_cpuid_id();
return pmu; return pmu;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment