提交 fff2e89f 编写于 作者: J Jacob Shin 提交者: Linus Torvalds

[PATCH] x86_64: mce_amd relocate sysfs files

Get rid of /sys/devices/system/threshold directory and move
mce_amd thresholding files into the machine sysfs directory --
/sys/devices/system/machinecheck.

AK: Fixed warning
Signed-off-by: NJacob Shin <jacob.shin@amd.com>
Signed-off-by: NAndi Kleen <ak@suse.de>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 17fc14ff
...@@ -562,7 +562,7 @@ static struct sysdev_class mce_sysclass = { ...@@ -562,7 +562,7 @@ static struct sysdev_class mce_sysclass = {
set_kset_name("machinecheck"), set_kset_name("machinecheck"),
}; };
static DEFINE_PER_CPU(struct sys_device, device_mce); DEFINE_PER_CPU(struct sys_device, device_mce);
/* Why are there no generic functions for this? */ /* Why are there no generic functions for this? */
#define ACCESSOR(name, var, start) \ #define ACCESSOR(name, var, start) \
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <asm/idle.h> #include <asm/idle.h>
#define PFX "mce_threshold: " #define PFX "mce_threshold: "
#define VERSION "version 1.00.9" #define VERSION "version 1.0.10"
#define NR_BANKS 5 #define NR_BANKS 5
#define THRESHOLD_MAX 0xFFF #define THRESHOLD_MAX 0xFFF
#define INT_TYPE_APIC 0x00020000 #define INT_TYPE_APIC 0x00020000
...@@ -166,12 +166,6 @@ asmlinkage void mce_threshold_interrupt(void) ...@@ -166,12 +166,6 @@ asmlinkage void mce_threshold_interrupt(void)
* Sysfs Interface * Sysfs Interface
*/ */
static struct sysdev_class threshold_sysclass = {
set_kset_name("threshold"),
};
static DEFINE_PER_CPU(struct sys_device, device_threshold);
struct threshold_attr { struct threshold_attr {
struct attribute attr; struct attribute attr;
ssize_t(*show) (struct threshold_bank *, char *); ssize_t(*show) (struct threshold_bank *, char *);
...@@ -332,8 +326,8 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, int bank) ...@@ -332,8 +326,8 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, int bank)
b = per_cpu(threshold_banks, lcpu)[bank]; b = per_cpu(threshold_banks, lcpu)[bank];
if (!b) if (!b)
goto out; goto out;
sprintf(name, "bank%i", bank); sprintf(name, "threshold_bank%i", bank);
err = sysfs_create_link(&per_cpu(device_threshold, cpu).kobj, err = sysfs_create_link(&per_cpu(device_mce, cpu).kobj,
&b->kobj, name); &b->kobj, name);
if (err) if (err)
goto out; goto out;
...@@ -353,8 +347,8 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, int bank) ...@@ -353,8 +347,8 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, int bank)
b->bank = bank; b->bank = bank;
b->interrupt_enable = 0; b->interrupt_enable = 0;
b->threshold_limit = THRESHOLD_MAX; b->threshold_limit = THRESHOLD_MAX;
kobject_set_name(&b->kobj, "bank%i", bank); kobject_set_name(&b->kobj, "threshold_bank%i", bank);
b->kobj.parent = &per_cpu(device_threshold, cpu).kobj; b->kobj.parent = &per_cpu(device_mce, cpu).kobj;
b->kobj.ktype = &threshold_ktype; b->kobj.ktype = &threshold_ktype;
err = kobject_register(&b->kobj); err = kobject_register(&b->kobj);
...@@ -373,12 +367,6 @@ static __cpuinit int threshold_create_device(unsigned int cpu) ...@@ -373,12 +367,6 @@ static __cpuinit int threshold_create_device(unsigned int cpu)
int bank; int bank;
int err = 0; int err = 0;
per_cpu(device_threshold, cpu).id = cpu;
per_cpu(device_threshold, cpu).cls = &threshold_sysclass;
err = sysdev_register(&per_cpu(device_threshold, cpu));
if (err)
goto out;
for (bank = 0; bank < NR_BANKS; ++bank) { for (bank = 0; bank < NR_BANKS; ++bank) {
if (!(per_cpu(bank_map, cpu) & 1 << bank)) if (!(per_cpu(bank_map, cpu) & 1 << bank))
continue; continue;
...@@ -407,8 +395,8 @@ static __cpuinit void threshold_remove_bank(unsigned int cpu, int bank) ...@@ -407,8 +395,8 @@ static __cpuinit void threshold_remove_bank(unsigned int cpu, int bank)
if (!b) if (!b)
return; return;
if (shared_bank[bank] && atomic_read(&b->kobj.kref.refcount) > 2) { if (shared_bank[bank] && atomic_read(&b->kobj.kref.refcount) > 2) {
sprintf(name, "bank%i", bank); sprintf(name, "threshold_bank%i", bank);
sysfs_remove_link(&per_cpu(device_threshold, cpu).kobj, name); sysfs_remove_link(&per_cpu(device_mce, cpu).kobj, name);
per_cpu(threshold_banks, cpu)[bank] = NULL; per_cpu(threshold_banks, cpu)[bank] = NULL;
} else { } else {
kobject_unregister(&b->kobj); kobject_unregister(&b->kobj);
...@@ -425,7 +413,6 @@ static __cpuinit void threshold_remove_device(unsigned int cpu) ...@@ -425,7 +413,6 @@ static __cpuinit void threshold_remove_device(unsigned int cpu)
continue; continue;
threshold_remove_bank(cpu, bank); threshold_remove_bank(cpu, bank);
} }
sysdev_unregister(&per_cpu(device_threshold, cpu));
} }
/* link all existing siblings when first core comes up */ /* link all existing siblings when first core comes up */
...@@ -518,23 +505,16 @@ static struct notifier_block threshold_cpu_notifier = { ...@@ -518,23 +505,16 @@ static struct notifier_block threshold_cpu_notifier = {
static __init int threshold_init_device(void) static __init int threshold_init_device(void)
{ {
int err;
int lcpu = 0; int lcpu = 0;
err = sysdev_class_register(&threshold_sysclass);
if (err)
goto out;
/* to hit CPUs online before the notifier is up */ /* to hit CPUs online before the notifier is up */
for_each_online_cpu(lcpu) { for_each_online_cpu(lcpu) {
err = threshold_create_device(lcpu); int err = threshold_create_device(lcpu);
if (err) if (err)
goto out; return err;
} }
register_cpu_notifier(&threshold_cpu_notifier); register_cpu_notifier(&threshold_cpu_notifier);
return 0;
out:
return err;
} }
device_initcall(threshold_init_device); device_initcall(threshold_init_device);
...@@ -74,6 +74,8 @@ struct mce_log { ...@@ -74,6 +74,8 @@ struct mce_log {
#include <asm/atomic.h> #include <asm/atomic.h>
void mce_log(struct mce *m); void mce_log(struct mce *m);
DECLARE_PER_CPU(struct sys_device, device_mce);
#ifdef CONFIG_X86_MCE_INTEL #ifdef CONFIG_X86_MCE_INTEL
void mce_intel_feature_init(struct cpuinfo_x86 *c); void mce_intel_feature_init(struct cpuinfo_x86 *c);
#else #else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册