From patchwork Mon Apr 28 17:57:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Moll X-Patchwork-Id: 4080571 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 54BF3BFF02 for ; Mon, 28 Apr 2014 18:01:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 66F45201F9 for ; Mon, 28 Apr 2014 18:01:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8DB4D20266 for ; Mon, 28 Apr 2014 18:01:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Weppa-0003Mm-4m; Mon, 28 Apr 2014 17:59:06 +0000 Received: from fw-tnat.austin.arm.com ([217.140.110.23] helo=collaborate-mta1.arm.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WeppB-00034M-FP for linux-arm-kernel@lists.infradead.org; Mon, 28 Apr 2014 17:58:42 +0000 Received: from hornet.Cambridge.Arm.com (hornet.cambridge.arm.com [10.2.201.45]) by collaborate-mta1.arm.com (Postfix) with ESMTP id 6F33013FEF5; Mon, 28 Apr 2014 12:58:12 -0500 (CDT) From: Pawel Moll To: Grant Likely , Rob Herring , Samuel Ortiz , Lee Jones , Arnd Bergmann , Greg Kroah-Hartman , Russell King Subject: [PATCH 07/10] ARM: vexpress: remove redundant vexpress_dt_cpus_num to get cpu count Date: Mon, 28 Apr 2014 18:57:54 +0100 Message-Id: <1398707877-22596-8-git-send-email-pawel.moll@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1398707877-22596-1-git-send-email-pawel.moll@arm.com> References: <1398707877-22596-1-git-send-email-pawel.moll@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140428_105841_586480_ABD729FD X-CRM114-Status: GOOD ( 13.18 ) X-Spam-Score: -0.7 (/) Cc: Sudeep KarkadaNagesha , arm@kernel.org, Pawel Moll , linux-kernel@vger.kernel.org, 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=-2.5 required=5.0 tests=BAYES_00,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 arm_dt_init_cpu_maps parses the device tree, validates and sets the cpu_possible_mask appropriately. It is unnecessary to do another DT parse to get the number of cpus, use num_possible_cpus instead. This patch also removes setting cpu_present_mask as platforms should only re-initialize it in smp_prepare_cpus() if present != possible. Signed-off-by: Sudeep KarkadaNagesha Signed-off-by: Pawel Moll --- arch/arm/mach-vexpress/platsmp.c | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c index 993c9ae..12a8751 100644 --- a/arch/arm/mach-vexpress/platsmp.c +++ b/arch/arm/mach-vexpress/platsmp.c @@ -77,39 +77,13 @@ void __init vexpress_dt_smp_map_io(void) WARN_ON(of_scan_flat_dt(vexpress_dt_find_scu, NULL)); } -static int __init vexpress_dt_cpus_num(unsigned long node, const char *uname, - int depth, void *data) -{ - static int prev_depth = -1; - static int nr_cpus = -1; - - if (prev_depth > depth && nr_cpus > 0) - return nr_cpus; - - if (nr_cpus < 0 && strcmp(uname, "cpus") == 0) - nr_cpus = 0; - - if (nr_cpus >= 0) { - const char *device_type = of_get_flat_dt_prop(node, - "device_type", NULL); - - if (device_type && strcmp(device_type, "cpu") == 0) - nr_cpus++; - } - - prev_depth = depth; - - return 0; -} - static void __init vexpress_dt_smp_init_cpus(void) { int ncores = 0, i; switch (vexpress_dt_scu) { case GENERIC_SCU: - ncores = of_scan_flat_dt(vexpress_dt_cpus_num, NULL); - break; + return; case CORTEX_A9_SCU: ncores = scu_get_core_count(vexpress_dt_cortex_a9_scu_base); break; @@ -133,12 +107,9 @@ static void __init vexpress_dt_smp_init_cpus(void) static void __init vexpress_dt_smp_prepare_cpus(unsigned int max_cpus) { - int i; switch (vexpress_dt_scu) { case GENERIC_SCU: - for (i = 0; i < max_cpus; i++) - set_cpu_present(i, true); break; case CORTEX_A9_SCU: scu_enable(vexpress_dt_cortex_a9_scu_base);