Commit 057ea4e1 authored by Dave Jones's avatar Dave Jones

[CPUFREQ] CodingStyle fixes for speedstep-smi

parent 5f27f461
......@@ -65,43 +65,45 @@ static struct cpufreq_frequency_table speedstep_freqs[] = {
*/
static int speedstep_smi_ownership (void)
{
u32 command, result, magic;
u32 function = GET_SPEEDSTEP_OWNER;
u32 command, result, magic;
u32 function = GET_SPEEDSTEP_OWNER;
unsigned char magic_data[] = "Copyright (c) 1999 Intel Corporation";
command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
magic = virt_to_phys(magic_data);
__asm__ __volatile__(
"out %%al, (%%dx)\n"
: "=D" (result)
: "a" (command), "b" (function), "c" (0), "d" (smi_port), "D" (0), "S" (magic)
);
__asm__ __volatile__(
"out %%al, (%%dx)\n"
: "=D" (result)
: "a" (command), "b" (function), "c" (0), "d" (smi_port), "D" (0), "S" (magic)
);
return result;
return result;
}
/**
* speedstep_smi_get_freqs - get SpeedStep preferred & current freq.
*
*/
static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high)
{
u32 command, result, edi, high_mhz, low_mhz;
u32 state=0;
u32 function = GET_SPEEDSTEP_FREQS;
u32 command, result, edi, high_mhz, low_mhz;
u32 state=0;
u32 function = GET_SPEEDSTEP_FREQS;
command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
__asm__ __volatile__("movl $0, %%edi\n"
"out %%al, (%%dx)\n"
: "=a" (result), "=b" (high_mhz), "=c" (low_mhz), "=d" (state), "=D" (edi)
: "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0)
);
__asm__ __volatile__("movl $0, %%edi\n"
"out %%al, (%%dx)\n"
: "=a" (result), "=b" (high_mhz), "=c" (low_mhz), "=d" (state), "=D" (edi)
: "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0)
);
*high = high_mhz * 1000;
*low = low_mhz * 1000;
return result;
}
/**
* speedstep_get_state - set the SpeedStep state
* @state: processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH)
......@@ -109,17 +111,17 @@ static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high)
*/
static int speedstep_get_state (void)
{
u32 function=GET_SPEEDSTEP_STATE;
u32 result, state, edi, command;
u32 function=GET_SPEEDSTEP_STATE;
u32 result, state, edi, command;
command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
__asm__ __volatile__("movl $0, %%edi\n"
"out %%al, (%%dx)\n"
: "=a" (result), "=b" (state), "=D" (edi)
: "a" (command), "b" (function), "c" (0), "d" (smi_port), "S" (0)
);
__asm__ __volatile__("movl $0, %%edi\n"
"out %%al, (%%dx)\n"
: "=a" (result), "=b" (state), "=D" (edi)
: "a" (command), "b" (function), "c" (0), "d" (smi_port), "S" (0)
);
return state;
}
......@@ -130,10 +132,10 @@ static int speedstep_get_state (void)
*/
static void speedstep_set_state (unsigned int state, unsigned int notify)
{
unsigned int old_state, result, command, new_state;
unsigned long flags;
struct cpufreq_freqs freqs;
unsigned int function=SET_SPEEDSTEP_STATE;
unsigned int old_state, result, command, new_state;
unsigned long flags;
struct cpufreq_freqs freqs;
unsigned int function=SET_SPEEDSTEP_STATE;
if (state > 0x1)
return;
......@@ -142,7 +144,7 @@ static void speedstep_set_state (unsigned int state, unsigned int notify)
freqs.old = speedstep_freqs[old_state].frequency;
freqs.new = speedstep_freqs[state].frequency;
freqs.cpu = 0; /* speedstep.c is UP only driver */
if (old_state == state)
return;
......@@ -152,13 +154,13 @@ static void speedstep_set_state (unsigned int state, unsigned int notify)
/* Disable IRQs */
local_irq_save(flags);
command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
__asm__ __volatile__(
"movl $0, %%edi\n"
"out %%al, (%%dx)\n"
: "=b" (new_state), "=D" (result)
: "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0)
);
command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
__asm__ __volatile__(
"movl $0, %%edi\n"
"out %%al, (%%dx)\n"
: "=b" (new_state), "=D" (result)
: "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0)
);
/* enable IRQs */
local_irq_restore(flags);
......@@ -185,10 +187,9 @@ static void speedstep_set_state (unsigned int state, unsigned int notify)
* Sets a new CPUFreq policy/freq.
*/
static int speedstep_target (struct cpufreq_policy *policy,
unsigned int target_freq,
unsigned int relation)
unsigned int target_freq, unsigned int relation)
{
unsigned int newstate = 0;
unsigned int newstate = 0;
if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], target_freq, relation, &newstate))
return -EINVAL;
......@@ -214,8 +215,8 @@ static int speedstep_verify (struct cpufreq_policy *policy)
static int speedstep_cpu_init(struct cpufreq_policy *policy)
{
int result;
unsigned int speed,state;
int result;
unsigned int speed,state;
/* capability check */
if (policy->cpu != 0)
......@@ -228,7 +229,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
/* detect low and high frequency */
result = speedstep_smi_get_freqs(&speedstep_freqs[SPEEDSTEP_LOW].frequency,
&speedstep_freqs[SPEEDSTEP_HIGH].frequency);
&speedstep_freqs[SPEEDSTEP_HIGH].frequency);
if (result) {
/* fall back to speedstep_lib.c dection mechanism: try both states out */
unsigned int speedstep_processor = speedstep_detect_processor();
......@@ -238,9 +239,9 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
return -ENODEV;
result = speedstep_get_freqs(speedstep_processor,
&speedstep_freqs[SPEEDSTEP_LOW].frequency,
&speedstep_freqs[SPEEDSTEP_HIGH].frequency,
&speedstep_set_state);
&speedstep_freqs[SPEEDSTEP_LOW].frequency,
&speedstep_freqs[SPEEDSTEP_HIGH].frequency,
&speedstep_set_state);
if (result) {
dprintk(KERN_INFO "speedstep-smi: could not detect two different speeds -- aborting.\n");
......@@ -294,7 +295,6 @@ static struct cpufreq_driver speedstep_driver = {
*/
static int __init speedstep_init(void)
{
dprintk("speedstep-smi: signature:0%.8lx, command:0lx%.8lx, event:0x%.8lx, perf_level:0x%.8lx.\n",
ist_info.signature, ist_info.command, ist_info.event, ist_info.perf_level);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment