• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

linux-3.0.x for AP-SH4A-0A Board


コミットメタ情報

リビジョン2988d6f59bdecf10e3a6f0e13861dc8108cd2faf (tree)
日時2011-08-23 01:28:30
作者Dave Martin <dave.martin@lina...>
コミッターNicolas Pitre

ログメッセージ

ARM: 7029/1: Make cpu_architecture into a global variable

The CPU architecture really should not be changing at runtime, so
make it a global variable instead of a function.

The cpu_architecture() function declared in <asm/system.h> remains
the correct way to read this variable from C code.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
Reviewed-by: Jon Medhurst <tixy@yxit.co.uk>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
(cherry picked from commit db9c84ccacb0e7a7903117929cf1dc914f82fc90)

変更サマリ

差分

--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -57,6 +57,7 @@
5757
5858 #ifndef __ASSEMBLY__
5959
60+#include <linux/compiler.h>
6061 #include <linux/linkage.h>
6162 #include <linux/irqflags.h>
6263
@@ -104,7 +105,7 @@ struct mm_struct;
104105 extern void show_pte(struct mm_struct *mm, unsigned long addr);
105106 extern void __show_regs(struct pt_regs *);
106107
107-extern int cpu_architecture(void);
108+extern int __pure cpu_architecture(void);
108109 extern void cpu_init(void);
109110
110111 void arm_machine_restart(char mode, const char *cmd);
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -29,6 +29,8 @@
2929 #include <linux/fs.h>
3030 #include <linux/proc_fs.h>
3131 #include <linux/memblock.h>
32+#include <linux/bug.h>
33+#include <linux/compiler.h>
3234
3335 #include <asm/unified.h>
3436 #include <asm/cpu.h>
@@ -42,6 +44,7 @@
4244 #include <asm/cacheflush.h>
4345 #include <asm/cachetype.h>
4446 #include <asm/tlbflush.h>
47+#include <asm/system.h>
4548
4649 #include <asm/prom.h>
4750 #include <asm/mach/arch.h>
@@ -115,6 +118,13 @@ struct outer_cache_fns outer_cache __read_mostly;
115118 EXPORT_SYMBOL(outer_cache);
116119 #endif
117120
121+/*
122+ * Cached cpu_architecture() result for use by assembler code.
123+ * C code should use the cpu_architecture() function instead of accessing this
124+ * variable directly.
125+ */
126+int __cpu_architecture __read_mostly = CPU_ARCH_UNKNOWN;
127+
118128 struct stack {
119129 u32 irq[3];
120130 u32 abt[3];
@@ -210,7 +220,7 @@ static const char *proc_arch[] = {
210220 "?(17)",
211221 };
212222
213-int cpu_architecture(void)
223+static int __get_cpu_architecture(void)
214224 {
215225 int cpu_arch;
216226
@@ -243,6 +253,13 @@ int cpu_architecture(void)
243253 return cpu_arch;
244254 }
245255
256+int __pure cpu_architecture(void)
257+{
258+ BUG_ON(__cpu_architecture == CPU_ARCH_UNKNOWN);
259+
260+ return __cpu_architecture;
261+}
262+
246263 static int cpu_has_aliasing_icache(unsigned int arch)
247264 {
248265 int aliasing_icache;
@@ -414,6 +431,7 @@ static void __init setup_processor(void)
414431 }
415432
416433 cpu_name = list->cpu_name;
434+ __cpu_architecture = __get_cpu_architecture();
417435
418436 #ifdef MULTI_CPU
419437 processor = *list->proc;