[ARM] pxamci: call mmc_remove_host() before freeing resources
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / edac / edac_mce_amd.c
index 0c21c370c9dd001c2da04e1c914c5248708f219e..713ed7d372475dc325ac7cfca8cc5e22181af29b 100644 (file)
@@ -3,6 +3,7 @@
 
 static bool report_gart_errors;
 static void (*nb_bus_decoder)(int node_id, struct err_regs *regs);
+static void (*orig_mce_callback)(struct mce *m);
 
 void amd_report_gart_errors(bool v)
 {
@@ -362,7 +363,7 @@ static inline void amd_decode_err_code(unsigned int ec)
                pr_warning("Huh? Unknown MCE error 0x%x\n", ec);
 }
 
-void decode_mce(struct mce *m)
+static void amd_decode_mce(struct mce *m)
 {
        struct err_regs regs;
        int node, ecc;
@@ -420,3 +421,32 @@ void decode_mce(struct mce *m)
 
        amd_decode_err_code(m->status & 0xffff);
 }
+
+static int __init mce_amd_init(void)
+{
+       /*
+        * We can decode MCEs for Opteron and later CPUs:
+        */
+       if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) &&
+           (boot_cpu_data.x86 >= 0xf)) {
+               /* safe the default decode mce callback */
+               orig_mce_callback = x86_mce_decode_callback;
+
+               x86_mce_decode_callback = amd_decode_mce;
+       }
+
+       return 0;
+}
+early_initcall(mce_amd_init);
+
+#ifdef MODULE
+static void __exit mce_amd_exit(void)
+{
+       x86_mce_decode_callback = orig_mce_callback;
+}
+
+MODULE_DESCRIPTION("AMD MCE decoder");
+MODULE_ALIAS("edac-mce-amd");
+MODULE_LICENSE("GPL");
+module_exit(mce_amd_exit);
+#endif