]> git.sur5r.net Git - groeck-k10temp/commitdiff
Improve compatibility with different kernel versions
authorGuenter Roeck <linux@roeck-us.net>
Wed, 25 Apr 2018 01:04:34 +0000 (18:04 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 25 Apr 2018 01:06:43 +0000 (18:06 -0700)
x86_mask has been renamed to x86_stepping.

compat.h [new file with mode: 0644]
k10temp.c

diff --git a/compat.h b/compat.h
new file mode 100644 (file)
index 0000000..345a17e
--- /dev/null
+++ b/compat.h
@@ -0,0 +1,18 @@
+/*---------------------------------------------------------------------------
+ *
+ * compat.h
+ *     Copyright (c) 2018 Guenter Roeck <linux@roeck-us.net>
+ *
+ *---------------------------------------------------------------------------
+ */
+
+#ifndef COMPAT_H
+#define COMPAT_H
+
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
+#define x86_stepping   x86_mask
+#endif
+
+#endif /* COMPAT_H */
index e4a179d491bed6da66eb36a8c1efed2eec1a15b1..6f8ffb9f945f22bfa3c5d5f7f64f9d4b0d9219c2 100644 (file)
--- a/k10temp.c
+++ b/k10temp.c
@@ -24,6 +24,7 @@
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <asm/processor.h>
+#include "compat.h"
 
 MODULE_DESCRIPTION("AMD Family 10h+ CPU core temperature monitor");
 MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
@@ -234,7 +235,7 @@ static bool has_erratum_319(struct pci_dev *pdev)
         * and AM3 formats, but that's the best we can do.
         */
        return boot_cpu_data.x86_model < 4 ||
-              (boot_cpu_data.x86_model == 4 && boot_cpu_data.x86_mask <= 2);
+              (boot_cpu_data.x86_model == 4 && boot_cpu_data.x86_stepping <= 2);
 }
 
 static int k10temp_probe(struct pci_dev *pdev,