From 484671790fb733076483e28585865d3012029466 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Tue, 24 Apr 2018 18:04:34 -0700 Subject: [PATCH] Improve compatibility with different kernel versions x86_mask has been renamed to x86_stepping. --- compat.h | 18 ++++++++++++++++++ k10temp.c | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 compat.h diff --git a/compat.h b/compat.h new file mode 100644 index 0000000..345a17e --- /dev/null +++ b/compat.h @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------- + * + * compat.h + * Copyright (c) 2018 Guenter Roeck + * + *--------------------------------------------------------------------------- + */ + +#ifndef COMPAT_H +#define COMPAT_H + +#include + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) +#define x86_stepping x86_mask +#endif + +#endif /* COMPAT_H */ diff --git a/k10temp.c b/k10temp.c index e4a179d..6f8ffb9 100644 --- a/k10temp.c +++ b/k10temp.c @@ -24,6 +24,7 @@ #include #include #include +#include "compat.h" MODULE_DESCRIPTION("AMD Family 10h+ CPU core temperature monitor"); MODULE_AUTHOR("Clemens Ladisch "); @@ -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, -- 2.39.2