Merge commit 'v2.6.39-rc3' into for-2.6.39
[pandora-kernel.git] / arch / x86 / kernel / microcode_core.c
index 87af68e..f924280 100644 (file)
@@ -82,6 +82,7 @@
 #include <linux/cpu.h>
 #include <linux/fs.h>
 #include <linux/mm.h>
+#include <linux/syscore_ops.h>
 
 #include <asm/microcode.h>
 #include <asm/processor.h>
@@ -438,33 +439,25 @@ static int mc_sysdev_remove(struct sys_device *sys_dev)
        return 0;
 }
 
-static int mc_sysdev_resume(struct sys_device *dev)
+static struct sysdev_driver mc_sysdev_driver = {
+       .add                    = mc_sysdev_add,
+       .remove                 = mc_sysdev_remove,
+};
+
+/**
+ * mc_bp_resume - Update boot CPU microcode during resume.
+ */
+static void mc_bp_resume(void)
 {
-       int cpu = dev->id;
+       int cpu = smp_processor_id();
        struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
 
-       if (!cpu_online(cpu))
-               return 0;
-
-       /*
-        * All non-bootup cpus are still disabled,
-        * so only CPU 0 will apply ucode here.
-        *
-        * Moreover, there can be no concurrent
-        * updates from any other places at this point.
-        */
-       WARN_ON(cpu != 0);
-
        if (uci->valid && uci->mc)
                microcode_ops->apply_microcode(cpu);
-
-       return 0;
 }
 
-static struct sysdev_driver mc_sysdev_driver = {
-       .add                    = mc_sysdev_add,
-       .remove                 = mc_sysdev_remove,
-       .resume                 = mc_sysdev_resume,
+static struct syscore_ops mc_syscore_ops = {
+       .resume                 = mc_bp_resume,
 };
 
 static __cpuinit int
@@ -542,6 +535,7 @@ static int __init microcode_init(void)
        if (error)
                return error;
 
+       register_syscore_ops(&mc_syscore_ops);
        register_hotcpu_notifier(&mc_cpu_notifier);
 
        pr_info("Microcode Update Driver: v" MICROCODE_VERSION
@@ -556,6 +550,7 @@ static void __exit microcode_exit(void)
        microcode_dev_exit();
 
        unregister_hotcpu_notifier(&mc_cpu_notifier);
+       unregister_syscore_ops(&mc_syscore_ops);
 
        get_online_cpus();
        mutex_lock(&microcode_mutex);