From patchwork Tue Aug 16 14:14:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot for Dave Martin X-Patchwork-Id: 1071742 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7GEEjRL017388 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 16 Aug 2011 14:15:07 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QtKPX-0002LJ-SG; Tue, 16 Aug 2011 14:14:32 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QtKPX-0004vJ-Di; Tue, 16 Aug 2011 14:14:31 +0000 Received: from mail-wy0-f177.google.com ([74.125.82.177]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QtKPT-0004u7-V2 for linux-arm-kernel@lists.infradead.org; Tue, 16 Aug 2011 14:14:28 +0000 Received: by wyh11 with SMTP id 11so126827wyh.36 for ; Tue, 16 Aug 2011 07:14:25 -0700 (PDT) Received: by 10.227.199.135 with SMTP id es7mr1424004wbb.7.1313504064564; Tue, 16 Aug 2011 07:14:24 -0700 (PDT) Received: from e200948.peterhouse.linaro.org (fw-lnat.cambridge.arm.com [217.140.96.63]) by mx.google.com with ESMTPS id fh17sm67551wbb.20.2011.08.16.07.14.23 (version=SSLv3 cipher=OTHER); Tue, 16 Aug 2011 07:14:24 -0700 (PDT) From: Dave Martin To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] ARM: Make cpu_alignment into a global variable Date: Tue, 16 Aug 2011 15:14:11 +0100 Message-Id: <1313504053-27873-2-git-send-email-dave.martin@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1313504053-27873-1-git-send-email-dave.martin@linaro.org> References: <1313504053-27873-1-git-send-email-dave.martin@linaro.org> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110816_101428_136669_1B5F454E X-CRM114-Status: GOOD ( 14.98 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.177 listed in list.dnswl.org] Cc: Nicolas Pitre , Jon Medhurst , patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 16 Aug 2011 14:15:08 +0000 (UTC) The CPU architecture really should not be changing at runtime, so make it a global variable instead of a function. The cpu_architecture() function in remains the correct way to read this variable from C code. Signed-off-by: Dave Martin Acked-by: Nicolas Pitre --- arch/arm/include/asm/system.h | 11 ++++++++++- arch/arm/kernel/setup.c | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h index 832888d..b0445f7 100644 --- a/arch/arm/include/asm/system.h +++ b/arch/arm/include/asm/system.h @@ -57,6 +57,8 @@ #ifndef __ASSEMBLY__ +#include +#include #include #include @@ -104,7 +106,14 @@ struct mm_struct; extern void show_pte(struct mm_struct *mm, unsigned long addr); extern void __show_regs(struct pt_regs *); -extern int cpu_architecture(void); +extern int __cpu_architecture; + +static inline int __pure cpu_architecture(void) +{ + BUG_ON(__cpu_architecture == CPU_ARCH_UNKNOWN); + return __cpu_architecture; +} + extern void cpu_init(void); void arm_machine_restart(char mode, const char *cmd); diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 70bca64..1e0c1b3 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -114,6 +115,7 @@ struct cpu_cache_fns cpu_cache __read_mostly; struct outer_cache_fns outer_cache __read_mostly; EXPORT_SYMBOL(outer_cache); #endif +int __cpu_architecture __read_mostly = CPU_ARCH_UNKNOWN; struct stack { u32 irq[3]; @@ -210,7 +212,7 @@ static const char *proc_arch[] = { "?(17)", }; -int cpu_architecture(void) +static int __init __get_cpu_architecture(void) { int cpu_arch; @@ -413,6 +415,7 @@ static void __init setup_processor(void) } cpu_name = list->cpu_name; + __cpu_architecture = __get_cpu_architecture(); #ifdef MULTI_CPU processor = *list->proc;