From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 13912C433F5 for ; Fri, 30 Sep 2022 11:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=v0Pm6yhUQelnEFOvCaN8wI3xVtUGyPjZdj+zBEA07as=; b=xui+Iulr0jRtZ7 Ra0fNewlErf2TZw33YMnvSQujXQRR6Z39jF9NVmVvcE55sMmDtib6ISRWBm9BL2CzXrR4+Cf4br5c fWK3pT9KHGU2I5Bn158CmmJfu9ki2gyyuAO+w3PTgMpshh+xdz6vYFfBtOYAae0XhoP4Mh6yYgLDq eTgaBS9PoevZRYTgLfX2KavRk4Suu7wfatv/ZhvnZP+JBx5EWRu8tk7LHBnzV7U8HgnFWjeFKqmmH d7sg11qgUAFV0zIdDckzaYcZ4MIvbQ88oo6Wj392L6NFl0b4ATzY4m1V+pz5dM7kKDWK5tYgi3ZQf I0/DzOGbCDh7s36T/UqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeE38-008o46-HC; Fri, 30 Sep 2022 11:19:22 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeE2n-008nyT-Ns for linux-arm-kernel@lists.infradead.org; Fri, 30 Sep 2022 11:19:04 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6801C244C; Fri, 30 Sep 2022 04:19:06 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D20BC3F73B; Fri, 30 Sep 2022 04:18:58 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: mark.rutland@arm.com, pierre.gondois@arm.com, valentin.schneider@arm.com, vschneid@redhat.com, will@kernel.org Subject: [PATCH 2/3] arm_pmu: factor out PMU matching Date: Fri, 30 Sep 2022 12:18:43 +0100 Message-Id: <20220930111844.1522365-3-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220930111844.1522365-1-mark.rutland@arm.com> References: <20220930111844.1522365-1-mark.rutland@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220930_041901_841582_F54843E6 X-CRM114-Status: GOOD ( 11.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Cc: Pierre Gondois Cc: Will Deacon --- drivers/perf/arm_pmu_acpi.c | 15 +++++++++++++-- 1 file 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 @@ static int arm_pmu_acpi_parse_irqs(void) 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; } -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel