|
@@ -523,6 +523,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
|
|
|
{
|
|
|
int i, err = 0;
|
|
|
struct threshold_bank *b = NULL;
|
|
|
+ struct device *dev = mce_device[cpu];
|
|
|
char name[32];
|
|
|
|
|
|
sprintf(name, "threshold_bank%i", bank);
|
|
@@ -543,8 +544,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
|
|
|
if (!b)
|
|
|
goto out;
|
|
|
|
|
|
- err = sysfs_create_link(&per_cpu(mce_device, cpu).kobj,
|
|
|
- b->kobj, name);
|
|
|
+ err = sysfs_create_link(&dev->kobj, b->kobj, name);
|
|
|
if (err)
|
|
|
goto out;
|
|
|
|
|
@@ -565,7 +565,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
|
|
|
goto out;
|
|
|
}
|
|
|
|
|
|
- b->kobj = kobject_create_and_add(name, &per_cpu(mce_device, cpu).kobj);
|
|
|
+ b->kobj = kobject_create_and_add(name, &dev->kobj);
|
|
|
if (!b->kobj)
|
|
|
goto out_free;
|
|
|
|
|
@@ -585,8 +585,9 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
|
|
|
if (i == cpu)
|
|
|
continue;
|
|
|
|
|
|
- err = sysfs_create_link(&per_cpu(mce_device, i).kobj,
|
|
|
- b->kobj, name);
|
|
|
+ dev = mce_device[i];
|
|
|
+ if (dev)
|
|
|
+ err = sysfs_create_link(&dev->kobj,b->kobj, name);
|
|
|
if (err)
|
|
|
goto out;
|
|
|
|
|
@@ -649,6 +650,7 @@ static void deallocate_threshold_block(unsigned int cpu,
|
|
|
static void threshold_remove_bank(unsigned int cpu, int bank)
|
|
|
{
|
|
|
struct threshold_bank *b;
|
|
|
+ struct device *dev;
|
|
|
char name[32];
|
|
|
int i = 0;
|
|
|
|
|
@@ -663,7 +665,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
|
|
|
#ifdef CONFIG_SMP
|
|
|
/* sibling symlink */
|
|
|
if (shared_bank[bank] && b->blocks->cpu != cpu) {
|
|
|
- sysfs_remove_link(&per_cpu(mce_device, cpu).kobj, name);
|
|
|
+ sysfs_remove_link(&mce_device[cpu]->kobj, name);
|
|
|
per_cpu(threshold_banks, cpu)[bank] = NULL;
|
|
|
|
|
|
return;
|
|
@@ -675,7 +677,9 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
|
|
|
if (i == cpu)
|
|
|
continue;
|
|
|
|
|
|
- sysfs_remove_link(&per_cpu(mce_device, i).kobj, name);
|
|
|
+ dev = mce_device[i];
|
|
|
+ if (dev)
|
|
|
+ sysfs_remove_link(&dev->kobj, name);
|
|
|
per_cpu(threshold_banks, i)[bank] = NULL;
|
|
|
}
|
|
|
|