linux/debian/patches/features/all/cpu-devices/Partially-revert-cpufreq-Ad...

56 lines
1.6 KiB
Diff

From: Ben Hutchings <ben@decadent.org.uk>
Date: Mon, 18 Jun 2012 02:56:40 +0100
Subject: Partially revert "cpufreq: Add support for x86 cpuinfo auto loading
v4"
This reverts commit fa8031aefec0cf7ea6c2387c93610d99d9659aa2 in
drivers/cpufreq/e_powersaver.c only.
e_powersaver may cause the CPU to run too fast on some systems, and is
therefore unsafe to auto-load.
---
drivers/cpufreq/e_powersaver.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/cpufreq/e_powersaver.c b/drivers/cpufreq/e_powersaver.c
index 3fffbe6..4bd6815 100644
--- a/drivers/cpufreq/e_powersaver.c
+++ b/drivers/cpufreq/e_powersaver.c
@@ -16,7 +16,6 @@
#include <linux/io.h>
#include <linux/delay.h>
-#include <asm/cpu_device_id.h>
#include <asm/msr.h>
#include <asm/tsc.h>
@@ -438,19 +437,18 @@ static struct cpufreq_driver eps_driver = {
.attr = eps_attr,
};
-
-/* This driver will work only on Centaur C7 processors with
- * Enhanced SpeedStep/PowerSaver registers */
-static const struct x86_cpu_id eps_cpu_id[] = {
- { X86_VENDOR_CENTAUR, 6, X86_MODEL_ANY, X86_FEATURE_EST },
- {}
-};
-MODULE_DEVICE_TABLE(x86cpu, eps_cpu_id);
-
static int __init eps_init(void)
{
- if (!x86_match_cpu(eps_cpu_id) || boot_cpu_data.x86_model < 10)
+ struct cpuinfo_x86 *c = &cpu_data(0);
+
+ /* This driver will work only on Centaur C7 processors with
+ * Enhanced SpeedStep/PowerSaver registers */
+ if (c->x86_vendor != X86_VENDOR_CENTAUR
+ || c->x86 != 6 || c->x86_model < 10)
+ return -ENODEV;
+ if (!cpu_has(c, X86_FEATURE_EST))
return -ENODEV;
+
if (cpufreq_register_driver(&eps_driver))
return -EINVAL;
return 0;