Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753336AbeABL0A (ORCPT + 1 other); Tue, 2 Jan 2018 06:26:00 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:37226 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753300AbeABLZ6 (ORCPT ); Tue, 2 Jan 2018 06:25:58 -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 , Catalin Marinas Subject: [PATCH v11 5/8] arm64: Use of_cpu_node_to_id helper for CPU topology parsing Date: Tue, 2 Jan 2018 11:25:30 +0000 Message-Id: <20180102112533.13640-6-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: Make use of the new generic helper to convert an of_node of a CPU to the logical CPU id in parsing the topology. Cc: Catalin Marinas Cc: Leo Yan Cc: Will Deacon Acked-by: Mark Rutland Signed-off-by: Suzuki K Poulose --- arch/arm64/kernel/topology.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index 8d48b233e6ce..21868530018e 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -37,18 +37,14 @@ static int __init get_cpu_for_node(struct device_node *node) if (!cpu_node) return -1; - for_each_possible_cpu(cpu) { - if (of_get_cpu_node(cpu, NULL) == cpu_node) { - topology_parse_cpu_capacity(cpu_node, cpu); - of_node_put(cpu_node); - return cpu; - } - } - - pr_crit("Unable to find CPU node for %pOF\n", cpu_node); + cpu = of_cpu_node_to_id(cpu_node); + if (cpu >= 0) + topology_parse_cpu_capacity(cpu_node, cpu); + else + pr_crit("Unable to find CPU node for %pOF\n", cpu_node); of_node_put(cpu_node); - return -1; + return cpu; } static int __init parse_core(struct device_node *core, int cluster_id, -- 2.13.6