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: Dave Martin X-Patchwork-Id: 3467 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 48EF323F6B for ; Tue, 16 Aug 2011 14:14:30 +0000 (UTC) Received: from mail-ey0-f170.google.com (mail-ey0-f170.google.com [209.85.215.170]) by fiordland.canonical.com (Postfix) with ESMTP id 40A60A18007 for ; Tue, 16 Aug 2011 14:14:30 +0000 (UTC) Received: by mail-ey0-f170.google.com with SMTP id 10so4676141eyd.29 for ; Tue, 16 Aug 2011 07:14:30 -0700 (PDT) Received: by 10.213.32.131 with SMTP id c3mr836759ebd.94.1313504069757; Tue, 16 Aug 2011 07:14:29 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.213.102.5 with SMTP id e5cs155308ebo; Tue, 16 Aug 2011 07:14:29 -0700 (PDT) Received: from mr.google.com ([10.216.234.201]) by 10.216.234.201 with SMTP id s51mr4774469weq.1.1313504068116 (num_hops = 1); Tue, 16 Aug 2011 07:14:28 -0700 (PDT) Received: by 10.216.234.201 with SMTP id s51mr3222989weq.1.1313504066837; Tue, 16 Aug 2011 07:14:26 -0700 (PDT) Received: from mail-wy0-f178.google.com (mail-wy0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id p54si255163weq.60.2011.08.16.07.14.24 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 16 Aug 2011 07:14:26 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of dave.martin@linaro.org) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of dave.martin@linaro.org) smtp.mail=dave.martin@linaro.org Received: by wyg19 with SMTP id 19so123752wyg.37 for ; Tue, 16 Aug 2011 07:14:24 -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 Cc: patches@linaro.org, Nicolas Pitre , Jon Medhurst 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> 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;