From patchwork Wed Oct 30 13:47:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep KarkadaNagesha X-Patchwork-Id: 3114671 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C67AF9F43F for ; Wed, 30 Oct 2013 13:47:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A156020383 for ; Wed, 30 Oct 2013 13:47:36 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 74D32201B6 for ; Wed, 30 Oct 2013 13:47:31 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VbW7K-0000KN-QN; Wed, 30 Oct 2013 13:47:26 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VbW7I-0007OU-Cm; Wed, 30 Oct 2013 13:47:24 +0000 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VbW7F-0007MJ-A1 for linux-arm-kernel@lists.infradead.org; Wed, 30 Oct 2013 13:47:22 +0000 Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.23]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id r9UDktki006081; Wed, 30 Oct 2013 13:46:55 GMT From: Sudeep KarkadaNagesha To: Catalin Marinas Subject: [PATCH] ARM64: simplify cpu_read_bootcpu_ops using OF/DT helper Date: Wed, 30 Oct 2013 13:47:16 +0000 Message-Id: <1383140836-11998-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> X-Mailer: git-send-email 1.8.1.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131030_094721_576259_533B972B X-CRM114-Status: GOOD ( 11.73 ) X-Spam-Score: -7.4 (-------) Cc: Sudeep.KarkadaNagesha@arm.com, Mark Rutland , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sudeep KarkadaNagesha Once the cpu_logical_map for any logical cpu is populated with the corresponding physical identifier(i.e. mpidr), it's device node can be retrieved using the DT helper 'of_get_cpu_node'. Currently the device tree parsing code to get boot cpu node is duplicated in 'cpu_read_bootcpu_ops'. This patch replaces the code parsing the device tree for the boot cpu with of_get_cpu_node. Signed-off-by: Sudeep KarkadaNagesha Cc: Catalin Marinas Cc: Mark Rutland --- arch/arm64/kernel/cpu_ops.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c index aa0c9e7..4fbe440 100644 --- a/arch/arm64/kernel/cpu_ops.c +++ b/arch/arm64/kernel/cpu_ops.c @@ -78,22 +78,10 @@ int __init cpu_read_ops(struct device_node *dn, int cpu) void __init cpu_read_bootcpu_ops(void) { - struct device_node *dn = NULL; - u64 mpidr = cpu_logical_map(0); - - while ((dn = of_find_node_by_type(dn, "cpu"))) { - u64 hwid; - const __be32 *prop; - - prop = of_get_property(dn, "reg", NULL); - if (!prop) - continue; - - hwid = of_read_number(prop, of_n_addr_cells(dn)); - if (hwid == mpidr) { - cpu_read_ops(dn, 0); - of_node_put(dn); - return; - } + struct device_node *dn = of_get_cpu_node(0, NULL); + if (!dn) { + pr_err("failed to find device node for boot cpu\n"); + return; } + cpu_read_ops(dn, 0); }