Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753382AbeABL0D (ORCPT + 1 other); Tue, 2 Jan 2018 06:26:03 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:37248 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753339AbeABL0A (ORCPT ); Tue, 2 Jan 2018 06:26:00 -0500 From: Suzuki K Poulose To: will.deacon@arm.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, robh@kernel.org, mathieu.poirier@linaro.org, leo.yan@linaro.org, peterz@infradead.org, mark.rutland@arm.com, frowand.list@gmail.com, marc.zyngier@arm.com, jonathan.cameron@huawei.com, sudeep.holla@arm.com, Suzuki K Poulose Subject: [PATCH v11 6/8] arm_pmu: Use of_cpu_node_to_id helper Date: Tue, 2 Jan 2018 11:25:31 +0000 Message-Id: <20180102112533.13640-7-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180102112533.13640-1-suzuki.poulose@arm.com> References: <20180102112533.13640-1-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Use the new generic helper, of_cpu_node_to_id(), to map a a phandle to the logical CPU number while parsing the PMU irq affinity. Cc: Will Deacon Acked-by: Mark Rutland Signed-off-by: Suzuki K Poulose --- drivers/perf/arm_pmu_platform.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/perf/arm_pmu_platform.c b/drivers/perf/arm_pmu_platform.c index 91b224eced18..46501cc79fd7 100644 --- a/drivers/perf/arm_pmu_platform.c +++ b/drivers/perf/arm_pmu_platform.c @@ -82,19 +82,10 @@ static int pmu_parse_irq_affinity(struct device_node *node, int i) return -EINVAL; } - /* Now look up the logical CPU number */ - for_each_possible_cpu(cpu) { - struct device_node *cpu_dn; - - cpu_dn = of_cpu_device_node_get(cpu); - of_node_put(cpu_dn); - - if (dn == cpu_dn) - break; - } - - if (cpu >= nr_cpu_ids) { + cpu = of_cpu_node_to_id(dn); + if (cpu < 0) { pr_warn("failed to find logical CPU for %s\n", dn->name); + cpu = nr_cpu_ids; } of_node_put(dn); -- 2.13.6