]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/cpu/mcheck/mce_64.c
Driver core: change sysdev classes to use dynamic kobject names
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / cpu / mcheck / mce_64.c
index b9f802e35209187a45045b3576027f9f0ac9de25..242e8668dbeb2a6904b9b15feee00f827e099d5f 100644 (file)
@@ -745,7 +745,7 @@ static void mce_restart(void)
 
 static struct sysdev_class mce_sysclass = {
        .resume = mce_resume,
-       set_kset_name("machinecheck"),
+       .name = "machinecheck",
 };
 
 DEFINE_PER_CPU(struct sys_device, device_mce);
@@ -802,13 +802,15 @@ static struct sysdev_attribute *mce_attributes[] = {
        NULL
 };
 
+static cpumask_t mce_device_initialized = CPU_MASK_NONE;
+
 /* Per cpu sysdev init.  All of the cpus still share the same ctl bank */
 static __cpuinit int mce_create_device(unsigned int cpu)
 {
        int err;
        int i;
 
-       if (!mce_available(&cpu_data(cpu)))
+       if (!mce_available(&boot_cpu_data))
                return -EIO;
 
        memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject));
@@ -825,6 +827,7 @@ static __cpuinit int mce_create_device(unsigned int cpu)
                if (err)
                        goto error;
        }
+       cpu_set(cpu, mce_device_initialized);
 
        return 0;
 error:
@@ -841,10 +844,14 @@ static void mce_remove_device(unsigned int cpu)
 {
        int i;
 
+       if (!cpu_isset(cpu, mce_device_initialized))
+               return;
+
        for (i = 0; mce_attributes[i]; i++)
                sysdev_remove_file(&per_cpu(device_mce,cpu),
                        mce_attributes[i]);
        sysdev_unregister(&per_cpu(device_mce,cpu));
+       cpu_clear(cpu, mce_device_initialized);
 }
 
 /* Get notified when a cpu comes on/off. Be hotplug friendly. */
@@ -852,21 +859,18 @@ static int
 mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
        unsigned int cpu = (unsigned long)hcpu;
-       int err = 0;
 
        switch (action) {
-       case CPU_UP_PREPARE:
-       case CPU_UP_PREPARE_FROZEN:
-               err = mce_create_device(cpu);
+       case CPU_ONLINE:
+       case CPU_ONLINE_FROZEN:
+               mce_create_device(cpu);
                break;
-       case CPU_UP_CANCELED:
-       case CPU_UP_CANCELED_FROZEN:
        case CPU_DEAD:
        case CPU_DEAD_FROZEN:
                mce_remove_device(cpu);
                break;
        }
-       return err ? NOTIFY_BAD : NOTIFY_OK;
+       return NOTIFY_OK;
 }
 
 static struct notifier_block mce_cpu_notifier = {