aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpuid.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-10-17 12:04:38 -0400
committerThomas Gleixner <tglx@inhelltoy.tec.linutronix.de>2007-10-17 14:16:19 -0400
commit4a40cb1ec68d021125e37a69a0be79dc16dd41b1 (patch)
tree730da450ede84a33241f77716edb25fbb8352088 /arch/x86/kernel/cpuid.c
parentcddf7ff766ee53e24ff37f55a897efc90cb3526e (diff)
i386: simplify smp_call_function_single() call sequence in cpuid
smp_call_function_single() now knows how to call the function on the current cpu. [ tglx: arch/x86 adaptation ] Cc: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Avi Kivity <avi@qumranet.com> Signed-off-by: Andi Kleen <ak@suse.de> Cc: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/cpuid.c')
-rw-r--r--arch/x86/kernel/cpuid.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index dffb102fb8c7..70dcf912d9fb 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -43,8 +43,6 @@
43 43
44static struct class *cpuid_class; 44static struct class *cpuid_class;
45 45
46#ifdef CONFIG_SMP
47
48struct cpuid_command { 46struct cpuid_command {
49 u32 reg; 47 u32 reg;
50 u32 *data; 48 u32 *data;
@@ -62,25 +60,11 @@ static inline void do_cpuid(int cpu, u32 reg, u32 * data)
62{ 60{
63 struct cpuid_command cmd; 61 struct cpuid_command cmd;
64 62
65 preempt_disable(); 63 cmd.reg = reg;
66 if (cpu == smp_processor_id()) { 64 cmd.data = data;
67 cpuid(reg, &data[0], &data[1], &data[2], &data[3]);
68 } else {
69 cmd.reg = reg;
70 cmd.data = data;
71 65
72 smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1, 1); 66 smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1, 1);
73 }
74 preempt_enable();
75} 67}
76#else /* ! CONFIG_SMP */
77
78static inline void do_cpuid(int cpu, u32 reg, u32 * data)
79{
80 cpuid(reg, &data[0], &data[1], &data[2], &data[3]);
81}
82
83#endif /* ! CONFIG_SMP */
84 68
85static loff_t cpuid_seek(struct file *file, loff_t offset, int orig) 69static loff_t cpuid_seek(struct file *file, loff_t offset, int orig)
86{ 70{