* Re: Fwd: [Bug 14340] New: speedstep-ich driver not working in 2.6.31
[not found] <20091007201108.GA16813@redhat.com>
@ 2009-10-19 3:48 ` Rusty Russell
2009-10-19 3:54 ` Andrew Morton
2009-10-19 5:03 ` [PATCH] cpufreq: use an enum for speedstep processor identification Rusty Russell
0 siblings, 2 replies; 3+ messages in thread
From: Rusty Russell @ 2009-10-19 3:48 UTC (permalink / raw)
To: Dave Jones; +Cc: Dominik Brodowski, dave.mueller, linux-kernel, Andrew Morton
On Thu, 8 Oct 2009 06:41:08 am Dave Jones wrote:
> http://bugzilla.kernel.org/show_bug.cgi?id=14340
>
> Summary: speedstep-ich driver not working in 2.6.31
> Product: Power Management
> Version: 2.5
> Kernel Version: 2.6.31
> Platform: All
> OS/Version: Linux
> Tree: Mainline
> Status: NEW
> Severity: normal
> Priority: P1
> Component: cpufreq
> AssignedTo: cpufreq@vger.kernel.org
> ReportedBy: dave.mueller@gmx.ch
> Regression: Yes
>
>
> It looks like commit 394122ab144dae4b276d74644a2f11c44a60ac5c broke the
> speedstep-ich driver.
Indeed. And the patch in that bug report works, but is suboptimal: we no
longer need the struct at all. You may want to apply that to -stable and
this to -linus.
Subject: speedstep-ich: fix error caused by 394122ab144dae4b276d74644a2f11c44a60ac5c
"[CPUFREQ] cpumask: avoid playing with cpus_allowed in speedstep-ich.c"
changed the code to mistakenly pass the current cpu as the "processor"
argument of speedstep_get_frequency(), whereas it should be the type of
the processor.
(Based on patch by dave.mueller@gmx.ch, compile-tested only)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
To: Dave Jones <davej@redhat.com>
To: Dominik Brodowski <linux@brodo.de>
Cc: dave.mueller@gmx.ch
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
index 6911e91..3ae5a7a 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
@@ -232,28 +232,23 @@ static unsigned int speedstep_detect_chipset(void)
return 0;
}
-struct get_freq_data {
- unsigned int speed;
- unsigned int processor;
-};
-
-static void get_freq_data(void *_data)
+static void get_freq_data(void *_speed)
{
- struct get_freq_data *data = _data;
+ unsigned int *speed = _speed;
- data->speed = speedstep_get_frequency(data->processor);
+ *speed = speedstep_get_frequency(speedstep_processor);
}
static unsigned int speedstep_get(unsigned int cpu)
{
- struct get_freq_data data = { .processor = cpu };
+ unsigned int speed;
/* You're supposed to ensure CPU is online. */
- if (smp_call_function_single(cpu, get_freq_data, &data, 1) != 0)
+ if (smp_call_function_single(cpu, get_freq_data, &speed, 1) != 0)
BUG();
- dprintk("detected %u kHz as current frequency\n", data.speed);
- return data.speed;
+ dprintk("detected %u kHz as current frequency\n", speed);
+ return speed;
}
/**
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: Fwd: [Bug 14340] New: speedstep-ich driver not working in 2.6.31
2009-10-19 3:48 ` Fwd: [Bug 14340] New: speedstep-ich driver not working in 2.6.31 Rusty Russell
@ 2009-10-19 3:54 ` Andrew Morton
2009-10-19 5:03 ` [PATCH] cpufreq: use an enum for speedstep processor identification Rusty Russell
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2009-10-19 3:54 UTC (permalink / raw)
To: Rusty Russell; +Cc: Dave Jones, Dominik Brodowski, dave.mueller, linux-kernel
On Mon, 19 Oct 2009 14:18:21 +1030 Rusty Russell <rusty@rustcorp.com.au> wrote:
> Subject: speedstep-ich: fix error caused by 394122ab144dae4b276d74644a2f11c44a60ac5c
>
> "[CPUFREQ] cpumask: avoid playing with cpus_allowed in speedstep-ich.c"
> changed the code to mistakenly pass the current cpu as the "processor"
> argument of speedstep_get_frequency(), whereas it should be the type of
> the processor.
>
> (Based on patch by dave.mueller@gmx.ch, compile-tested only)
>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> To: Dave Jones <davej@redhat.com>
> To: Dominik Brodowski <linux@brodo.de>
> Cc: dave.mueller@gmx.ch
administriviata:
- Please include the full URL to the bugzilla report in the changelog
when fixing bugzilla reports. To make it easy and reliable for people
who troll the commits closing off reports. I use the format:
Addresses http://bugzilla.kernel.org/show_bug.cgi?id=14340
- Please give the reporter a "Reported-by:". And a beer.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] cpufreq: use an enum for speedstep processor identification
2009-10-19 3:48 ` Fwd: [Bug 14340] New: speedstep-ich driver not working in 2.6.31 Rusty Russell
2009-10-19 3:54 ` Andrew Morton
@ 2009-10-19 5:03 ` Rusty Russell
1 sibling, 0 replies; 3+ messages in thread
From: Rusty Russell @ 2009-10-19 5:03 UTC (permalink / raw)
To: Dave Jones; +Cc: Dominik Brodowski, dave.mueller, linux-kernel, Andrew Morton
The "unsigned int processor" everywhere confused Rusty, leading to
breakage when he passed in smp_processor_id().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
@@ -39,7 +39,7 @@ static struct pci_dev *speedstep_chipset
/* speedstep_processor
*/
-static unsigned int speedstep_processor;
+static enum speedstep_processor speedstep_processor;
static u32 pmbase;
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
@@ -34,7 +34,7 @@ static int relaxed_check;
* GET PROCESSOR CORE SPEED IN KHZ *
*********************************************************************/
-static unsigned int pentium3_get_frequency(unsigned int processor)
+static unsigned int pentium3_get_frequency(enum speedstep_processor processor)
{
/* See table 14 of p3_ds.pdf and table 22 of 29834003.pdf */
struct {
@@ -227,7 +227,7 @@ static unsigned int pentium4_get_frequen
/* Warning: may get called from smp_call_function_single. */
-unsigned int speedstep_get_frequency(unsigned int processor)
+unsigned int speedstep_get_frequency(enum speedstep_processor processor)
{
switch (processor) {
case SPEEDSTEP_CPU_PCORE:
@@ -380,7 +380,7 @@ EXPORT_SYMBOL_GPL(speedstep_detect_proce
* DETECT SPEEDSTEP SPEEDS *
*********************************************************************/
-unsigned int speedstep_get_freqs(unsigned int processor,
+unsigned int speedstep_get_freqs(enum speedstep_processor processor,
unsigned int *low_speed,
unsigned int *high_speed,
unsigned int *transition_latency,
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.h b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.h
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.h
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.h
@@ -11,18 +11,18 @@
/* processors */
-
-#define SPEEDSTEP_CPU_PIII_C_EARLY 0x00000001 /* Coppermine core */
-#define SPEEDSTEP_CPU_PIII_C 0x00000002 /* Coppermine core */
-#define SPEEDSTEP_CPU_PIII_T 0x00000003 /* Tualatin core */
-#define SPEEDSTEP_CPU_P4M 0x00000004 /* P4-M */
-
+enum speedstep_processor {
+ SPEEDSTEP_CPU_PIII_C_EARLY = 0x00000001, /* Coppermine core */
+ SPEEDSTEP_CPU_PIII_C = 0x00000002, /* Coppermine core */
+ SPEEDSTEP_CPU_PIII_T = 0x00000003, /* Tualatin core */
+ SPEEDSTEP_CPU_P4M = 0x00000004, /* P4-M */
/* the following processors are not speedstep-capable and are not auto-detected
* in speedstep_detect_processor(). However, their speed can be detected using
* the speedstep_get_frequency() call. */
-#define SPEEDSTEP_CPU_PM 0xFFFFFF03 /* Pentium M */
-#define SPEEDSTEP_CPU_P4D 0xFFFFFF04 /* desktop P4 */
-#define SPEEDSTEP_CPU_PCORE 0xFFFFFF05 /* Core */
+ SPEEDSTEP_CPU_PM = 0xFFFFFF03, /* Pentium M */
+ SPEEDSTEP_CPU_P4D = 0xFFFFFF04, /* desktop P4 */
+ SPEEDSTEP_CPU_PCORE = 0xFFFFFF05, /* Core */
+};
/* speedstep states -- only two of them */
@@ -31,10 +31,10 @@
/* detect a speedstep-capable processor */
-extern unsigned int speedstep_detect_processor (void);
+extern enum speedstep_processor speedstep_detect_processor (void);
/* detect the current speed (in khz) of the processor */
-extern unsigned int speedstep_get_frequency(unsigned int processor);
+extern unsigned int speedstep_get_frequency(enum speedstep_processor processor);
/* detect the low and high speeds of the processor. The callback
@@ -42,7 +42,7 @@ extern unsigned int speedstep_get_freque
* SPEEDSTEP_LOW; the second argument is zero so that no
* cpufreq_notify_transition calls are initiated.
*/
-extern unsigned int speedstep_get_freqs(unsigned int processor,
+extern unsigned int speedstep_get_freqs(enum speedstep_processor processor,
unsigned int *low_speed,
unsigned int *high_speed,
unsigned int *transition_latency,
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c b/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c
@@ -35,7 +35,7 @@ static int smi_cmd;
static unsigned int smi_sig;
/* info about the processor */
-static unsigned int speedstep_processor;
+static enum speedstep_processor speedstep_processor;
/*
* There are only two frequency states for each processor. Values
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-19 5:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20091007201108.GA16813@redhat.com>
2009-10-19 3:48 ` Fwd: [Bug 14340] New: speedstep-ich driver not working in 2.6.31 Rusty Russell
2009-10-19 3:54 ` Andrew Morton
2009-10-19 5:03 ` [PATCH] cpufreq: use an enum for speedstep processor identification Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox