Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[CPUFREQ] use an enum for speedstep processor identification

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>
Acked-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Jones <davej@redhat.com>

authored by

Rusty Russell and committed by
Dave Jones
1cce76c2 bbe237aa

+17 -17
+1 -1
arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
··· 39 39 40 40 /* speedstep_processor 41 41 */ 42 - static unsigned int speedstep_processor; 42 + static enum speedstep_processor speedstep_processor; 43 43 44 44 static u32 pmbase; 45 45
+3 -3
arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
··· 34 34 * GET PROCESSOR CORE SPEED IN KHZ * 35 35 *********************************************************************/ 36 36 37 - static unsigned int pentium3_get_frequency(unsigned int processor) 37 + static unsigned int pentium3_get_frequency(enum speedstep_processor processor) 38 38 { 39 39 /* See table 14 of p3_ds.pdf and table 22 of 29834003.pdf */ 40 40 struct { ··· 227 227 228 228 229 229 /* Warning: may get called from smp_call_function_single. */ 230 - unsigned int speedstep_get_frequency(unsigned int processor) 230 + unsigned int speedstep_get_frequency(enum speedstep_processor processor) 231 231 { 232 232 switch (processor) { 233 233 case SPEEDSTEP_CPU_PCORE: ··· 380 380 * DETECT SPEEDSTEP SPEEDS * 381 381 *********************************************************************/ 382 382 383 - unsigned int speedstep_get_freqs(unsigned int processor, 383 + unsigned int speedstep_get_freqs(enum speedstep_processor processor, 384 384 unsigned int *low_speed, 385 385 unsigned int *high_speed, 386 386 unsigned int *transition_latency,
+12 -12
arch/x86/kernel/cpu/cpufreq/speedstep-lib.h
··· 11 11 12 12 13 13 /* processors */ 14 - 15 - #define SPEEDSTEP_CPU_PIII_C_EARLY 0x00000001 /* Coppermine core */ 16 - #define SPEEDSTEP_CPU_PIII_C 0x00000002 /* Coppermine core */ 17 - #define SPEEDSTEP_CPU_PIII_T 0x00000003 /* Tualatin core */ 18 - #define SPEEDSTEP_CPU_P4M 0x00000004 /* P4-M */ 19 - 14 + enum speedstep_processor { 15 + SPEEDSTEP_CPU_PIII_C_EARLY = 0x00000001, /* Coppermine core */ 16 + SPEEDSTEP_CPU_PIII_C = 0x00000002, /* Coppermine core */ 17 + SPEEDSTEP_CPU_PIII_T = 0x00000003, /* Tualatin core */ 18 + SPEEDSTEP_CPU_P4M = 0x00000004, /* P4-M */ 20 19 /* the following processors are not speedstep-capable and are not auto-detected 21 20 * in speedstep_detect_processor(). However, their speed can be detected using 22 21 * the speedstep_get_frequency() call. */ 23 - #define SPEEDSTEP_CPU_PM 0xFFFFFF03 /* Pentium M */ 24 - #define SPEEDSTEP_CPU_P4D 0xFFFFFF04 /* desktop P4 */ 25 - #define SPEEDSTEP_CPU_PCORE 0xFFFFFF05 /* Core */ 22 + SPEEDSTEP_CPU_PM = 0xFFFFFF03, /* Pentium M */ 23 + SPEEDSTEP_CPU_P4D = 0xFFFFFF04, /* desktop P4 */ 24 + SPEEDSTEP_CPU_PCORE = 0xFFFFFF05, /* Core */ 25 + }; 26 26 27 27 /* speedstep states -- only two of them */ 28 28 ··· 31 31 32 32 33 33 /* detect a speedstep-capable processor */ 34 - extern unsigned int speedstep_detect_processor (void); 34 + extern enum speedstep_processor speedstep_detect_processor(void); 35 35 36 36 /* detect the current speed (in khz) of the processor */ 37 - extern unsigned int speedstep_get_frequency(unsigned int processor); 37 + extern unsigned int speedstep_get_frequency(enum speedstep_processor processor); 38 38 39 39 40 40 /* detect the low and high speeds of the processor. The callback ··· 42 42 * SPEEDSTEP_LOW; the second argument is zero so that no 43 43 * cpufreq_notify_transition calls are initiated. 44 44 */ 45 - extern unsigned int speedstep_get_freqs(unsigned int processor, 45 + extern unsigned int speedstep_get_freqs(enum speedstep_processor processor, 46 46 unsigned int *low_speed, 47 47 unsigned int *high_speed, 48 48 unsigned int *transition_latency,
+1 -1
arch/x86/kernel/cpu/cpufreq/speedstep-smi.c
··· 35 35 static unsigned int smi_sig; 36 36 37 37 /* info about the processor */ 38 - static unsigned int speedstep_processor; 38 + static enum speedstep_processor speedstep_processor; 39 39 40 40 /* 41 41 * There are only two frequency states for each processor. Values