aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>2009-04-08 06:31:18 -0400
committerH. Peter Anvin <hpa@zytor.com>2009-05-28 12:24:16 -0400
commit34fa1967aa0827776e37feb5666df0327575a0f2 (patch)
tree0f2751aad92cb88eca21f70a7eca1be0fabc7c54 /arch/x86
parent14a02530e2239f753a0f3f089847e723adbdaa47 (diff)
x86, mce: trivial clean up for mce_amd_64.c
Fix for followings: WARNING: Use #include <linux/percpu.h> instead of <asm/percpu.h> +#include <asm/percpu.h> ERROR: Macros with multiple statements should be enclosed in a do - while loop +#define THRESHOLD_ATTR(_name, _mode, _show, _store) \ +{ \ + .attr = {.name = __stringify(_name), .mode = _mode }, \ + .show = _show, \ + .store = _store, \ +}; WARNING: usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc + if (cpu >= NR_CPUS) Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Cc: Andi Kleen <andi@firstfloor.org> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd_64.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
index 0c563432e25c..ddae21620bda 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
@@ -16,6 +16,7 @@
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/notifier.h> 17#include <linux/notifier.h>
18#include <linux/kobject.h> 18#include <linux/kobject.h>
19#include <linux/percpu.h>
19#include <linux/sysdev.h> 20#include <linux/sysdev.h>
20#include <linux/errno.h> 21#include <linux/errno.h>
21#include <linux/sched.h> 22#include <linux/sched.h>
@@ -24,7 +25,6 @@
24#include <linux/cpu.h> 25#include <linux/cpu.h>
25#include <linux/smp.h> 26#include <linux/smp.h>
26 27
27#include <asm/percpu.h>
28#include <asm/apic.h> 28#include <asm/apic.h>
29#include <asm/idle.h> 29#include <asm/idle.h>
30#include <asm/mce.h> 30#include <asm/mce.h>
@@ -344,17 +344,13 @@ static ssize_t store_error_count(struct threshold_block *b,
344 return 1; 344 return 1;
345} 345}
346 346
347#define THRESHOLD_ATTR(_name, _mode, _show, _store) \ 347#define RW_ATTR(val) \
348{ \ 348static struct threshold_attr val = { \
349 .attr = {.name = __stringify(_name), .mode = _mode }, \ 349 .attr = {.name = __stringify(val), .mode = 0644 }, \
350 .show = _show, \ 350 .show = show_## val, \
351 .store = _store, \ 351 .store = store_## val, \
352}; 352};
353 353
354#define RW_ATTR(name) \
355static struct threshold_attr name = \
356 THRESHOLD_ATTR(name, 0644, show_## name, store_## name)
357
358RW_ATTR(interrupt_enable); 354RW_ATTR(interrupt_enable);
359RW_ATTR(threshold_limit); 355RW_ATTR(threshold_limit);
360RW_ATTR(error_count); 356RW_ATTR(error_count);
@@ -675,9 +671,6 @@ static void threshold_remove_device(unsigned int cpu)
675static void __cpuinit 671static void __cpuinit
676amd_64_threshold_cpu_callback(unsigned long action, unsigned int cpu) 672amd_64_threshold_cpu_callback(unsigned long action, unsigned int cpu)
677{ 673{
678 if (cpu >= NR_CPUS)
679 return;
680
681 switch (action) { 674 switch (action) {
682 case CPU_ONLINE: 675 case CPU_ONLINE:
683 case CPU_ONLINE_FROZEN: 676 case CPU_ONLINE_FROZEN: