[CPUFREQ][5/8] acpi-cpufreq: lindent acpi-cpufreq.c

Lindent acpi-cpufreq. Additional changes replacing "return (..)" by "return ..".
No functionality changes in this patch.

Signed-off-by: Denis Sadykov <denis.m.sadykov@intel.com>
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Dave Jones <davej@redhat.com>
This commit is contained in:
Venkatesh Pallipadi 2006-10-03 12:35:23 -07:00 committed by Dave Jones
parent 83d0515bbb
commit 64be7eedb2
1 changed files with 139 additions and 160 deletions

View File

@ -51,7 +51,6 @@ MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski");
MODULE_DESCRIPTION("ACPI Processor P-States Driver"); MODULE_DESCRIPTION("ACPI Processor P-States Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
enum { enum {
UNDEFINED_CAPABLE = 0, UNDEFINED_CAPABLE = 0,
SYSTEM_INTEL_MSR_CAPABLE, SYSTEM_INTEL_MSR_CAPABLE,
@ -61,36 +60,34 @@ enum {
#define INTEL_MSR_RANGE (0xffff) #define INTEL_MSR_RANGE (0xffff)
struct acpi_cpufreq_data { struct acpi_cpufreq_data {
struct acpi_processor_performance *acpi_data; struct acpi_processor_performance *acpi_data;
struct cpufreq_frequency_table *freq_table; struct cpufreq_frequency_table *freq_table;
unsigned int resume; unsigned int resume;
unsigned int cpu_feature; unsigned int cpu_feature;
}; };
static struct acpi_cpufreq_data *drv_data[NR_CPUS]; static struct acpi_cpufreq_data *drv_data[NR_CPUS];
static struct acpi_processor_performance *acpi_perf_data[NR_CPUS]; static struct acpi_processor_performance *acpi_perf_data[NR_CPUS];
static struct cpufreq_driver acpi_cpufreq_driver; static struct cpufreq_driver acpi_cpufreq_driver;
static unsigned int acpi_pstate_strict; static unsigned int acpi_pstate_strict;
static int check_est_cpu(unsigned int cpuid) static int check_est_cpu(unsigned int cpuid)
{ {
struct cpuinfo_x86 *cpu = &cpu_data[cpuid]; struct cpuinfo_x86 *cpu = &cpu_data[cpuid];
if (cpu->x86_vendor != X86_VENDOR_INTEL || if (cpu->x86_vendor != X86_VENDOR_INTEL ||
!cpu_has(cpu, X86_FEATURE_EST)) !cpu_has(cpu, X86_FEATURE_EST))
return 0; return 0;
return 1; return 1;
} }
static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data) static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data)
{ {
struct acpi_processor_performance *perf; struct acpi_processor_performance *perf;
int i; int i;
perf = data->acpi_data; perf = data->acpi_data;
@ -101,7 +98,6 @@ static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data)
return 0; return 0;
} }
static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data) static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
{ {
int i; int i;
@ -114,15 +110,14 @@ static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
return data->freq_table[0].frequency; return data->freq_table[0].frequency;
} }
static unsigned extract_freq(u32 val, struct acpi_cpufreq_data *data) static unsigned extract_freq(u32 val, struct acpi_cpufreq_data *data)
{ {
switch (data->cpu_feature) { switch (data->cpu_feature) {
case SYSTEM_INTEL_MSR_CAPABLE: case SYSTEM_INTEL_MSR_CAPABLE:
return extract_msr(val, data); return extract_msr(val, data);
case SYSTEM_IO_CAPABLE: case SYSTEM_IO_CAPABLE:
return extract_io(val, data); return extract_io(val, data);
default: default:
return 0; return 0;
} }
} }
@ -138,7 +133,7 @@ static void wrport(u16 port, u8 bit_width, u32 value)
} }
} }
static void rdport(u16 port, u8 bit_width, u32 *ret) static void rdport(u16 port, u8 bit_width, u32 * ret)
{ {
*ret = 0; *ret = 0;
if (bit_width <= 8) { if (bit_width <= 8) {
@ -176,13 +171,13 @@ static void do_drv_read(struct drv_cmd *cmd)
u32 h; u32 h;
switch (cmd->type) { switch (cmd->type) {
case SYSTEM_INTEL_MSR_CAPABLE: case SYSTEM_INTEL_MSR_CAPABLE:
rdmsr(cmd->addr.msr.reg, cmd->val, h); rdmsr(cmd->addr.msr.reg, cmd->val, h);
break; break;
case SYSTEM_IO_CAPABLE: case SYSTEM_IO_CAPABLE:
rdport(cmd->addr.io.port, cmd->addr.io.bit_width, &cmd->val); rdport(cmd->addr.io.port, cmd->addr.io.bit_width, &cmd->val);
break; break;
default: default:
break; break;
} }
} }
@ -192,20 +187,20 @@ static void do_drv_write(struct drv_cmd *cmd)
u32 h = 0; u32 h = 0;
switch (cmd->type) { switch (cmd->type) {
case SYSTEM_INTEL_MSR_CAPABLE: case SYSTEM_INTEL_MSR_CAPABLE:
wrmsr(cmd->addr.msr.reg, cmd->val, h); wrmsr(cmd->addr.msr.reg, cmd->val, h);
break; break;
case SYSTEM_IO_CAPABLE: case SYSTEM_IO_CAPABLE:
wrport(cmd->addr.io.port, cmd->addr.io.bit_width, cmd->val); wrport(cmd->addr.io.port, cmd->addr.io.bit_width, cmd->val);
break; break;
default: default:
break; break;
} }
} }
static inline void drv_read(struct drv_cmd *cmd) static inline void drv_read(struct drv_cmd *cmd)
{ {
cpumask_t saved_mask = current->cpus_allowed; cpumask_t saved_mask = current->cpus_allowed;
cmd->val = 0; cmd->val = 0;
set_cpus_allowed(current, cmd->mask); set_cpus_allowed(current, cmd->mask);
@ -216,8 +211,8 @@ static inline void drv_read(struct drv_cmd *cmd)
static void drv_write(struct drv_cmd *cmd) static void drv_write(struct drv_cmd *cmd)
{ {
cpumask_t saved_mask = current->cpus_allowed; cpumask_t saved_mask = current->cpus_allowed;
unsigned int i; unsigned int i;
for_each_cpu_mask(i, cmd->mask) { for_each_cpu_mask(i, cmd->mask) {
set_cpus_allowed(current, cpumask_of_cpu(i)); set_cpus_allowed(current, cpumask_of_cpu(i));
@ -230,8 +225,8 @@ static void drv_write(struct drv_cmd *cmd)
static u32 get_cur_val(cpumask_t mask) static u32 get_cur_val(cpumask_t mask)
{ {
struct acpi_processor_performance *perf; struct acpi_processor_performance *perf;
struct drv_cmd cmd; struct drv_cmd cmd;
if (unlikely(cpus_empty(mask))) if (unlikely(cpus_empty(mask)))
return 0; return 0;
@ -262,14 +257,13 @@ static u32 get_cur_val(cpumask_t mask)
static unsigned int get_cur_freq_on_cpu(unsigned int cpu) static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
{ {
struct acpi_cpufreq_data *data = drv_data[cpu]; struct acpi_cpufreq_data *data = drv_data[cpu];
unsigned int freq; unsigned int freq;
dprintk("get_cur_freq_on_cpu (%d)\n", cpu); dprintk("get_cur_freq_on_cpu (%d)\n", cpu);
if (unlikely(data == NULL || if (unlikely(data == NULL ||
data->acpi_data == NULL || data->acpi_data == NULL || data->freq_table == NULL)) {
data->freq_table == NULL)) {
return 0; return 0;
} }
@ -280,10 +274,10 @@ static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
} }
static unsigned int check_freqs(cpumask_t mask, unsigned int freq, static unsigned int check_freqs(cpumask_t mask, unsigned int freq,
struct acpi_cpufreq_data *data) struct acpi_cpufreq_data *data)
{ {
unsigned int cur_freq; unsigned int cur_freq;
unsigned int i; unsigned int i;
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
cur_freq = extract_freq(get_cur_val(mask), data); cur_freq = extract_freq(get_cur_val(mask), data);
@ -295,34 +289,31 @@ static unsigned int check_freqs(cpumask_t mask, unsigned int freq,
} }
static int acpi_cpufreq_target(struct cpufreq_policy *policy, static int acpi_cpufreq_target(struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int target_freq, unsigned int relation)
unsigned int relation)
{ {
struct acpi_cpufreq_data *data = drv_data[policy->cpu]; struct acpi_cpufreq_data *data = drv_data[policy->cpu];
struct acpi_processor_performance *perf; struct acpi_processor_performance *perf;
struct cpufreq_freqs freqs; struct cpufreq_freqs freqs;
cpumask_t online_policy_cpus; cpumask_t online_policy_cpus;
struct drv_cmd cmd; struct drv_cmd cmd;
unsigned int msr; unsigned int msr;
unsigned int next_state = 0; unsigned int next_state = 0;
unsigned int next_perf_state = 0; unsigned int next_perf_state = 0;
unsigned int i; unsigned int i;
int result = 0; int result = 0;
dprintk("acpi_cpufreq_target %d (%d)\n", target_freq, policy->cpu); dprintk("acpi_cpufreq_target %d (%d)\n", target_freq, policy->cpu);
if (unlikely(data == NULL || if (unlikely(data == NULL ||
data->acpi_data == NULL || data->acpi_data == NULL || data->freq_table == NULL)) {
data->freq_table == NULL)) {
return -ENODEV; return -ENODEV;
} }
perf = data->acpi_data; perf = data->acpi_data;
result = cpufreq_frequency_table_target(policy, result = cpufreq_frequency_table_target(policy,
data->freq_table, data->freq_table,
target_freq, target_freq,
relation, relation, &next_state);
&next_state);
if (unlikely(result)) if (unlikely(result))
return -ENODEV; return -ENODEV;
@ -339,30 +330,34 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
next_perf_state = data->freq_table[next_state].index; next_perf_state = data->freq_table[next_state].index;
if (freqs.new == freqs.old) { if (freqs.new == freqs.old) {
if (unlikely(data->resume)) { if (unlikely(data->resume)) {
dprintk("Called after resume, resetting to P%d\n", next_perf_state); dprintk("Called after resume, resetting to P%d\n",
next_perf_state);
data->resume = 0; data->resume = 0;
} else { } else {
dprintk("Already at target state (P%d)\n", next_perf_state); dprintk("Already at target state (P%d)\n",
next_perf_state);
return 0; return 0;
} }
} }
switch (data->cpu_feature) { switch (data->cpu_feature) {
case SYSTEM_INTEL_MSR_CAPABLE: case SYSTEM_INTEL_MSR_CAPABLE:
cmd.type = SYSTEM_INTEL_MSR_CAPABLE; cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
cmd.addr.msr.reg = MSR_IA32_PERF_CTL; cmd.addr.msr.reg = MSR_IA32_PERF_CTL;
msr = (u32) perf->states[next_perf_state].control & INTEL_MSR_RANGE; msr =
cmd.val = (cmd.val & ~INTEL_MSR_RANGE) | msr; (u32) perf->states[next_perf_state].
break; control & INTEL_MSR_RANGE;
case SYSTEM_IO_CAPABLE: cmd.val = (cmd.val & ~INTEL_MSR_RANGE) | msr;
cmd.type = SYSTEM_IO_CAPABLE; break;
cmd.addr.io.port = perf->control_register.address; case SYSTEM_IO_CAPABLE:
cmd.addr.io.bit_width = perf->control_register.bit_width; cmd.type = SYSTEM_IO_CAPABLE;
cmd.val = (u32) perf->states[next_perf_state].control; cmd.addr.io.port = perf->control_register.address;
break; cmd.addr.io.bit_width = perf->control_register.bit_width;
default: cmd.val = (u32) perf->states[next_perf_state].control;
return -ENODEV; break;
} default:
return -ENODEV;
}
cpus_clear(cmd.mask); cpus_clear(cmd.mask);
@ -381,7 +376,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
if (acpi_pstate_strict) { if (acpi_pstate_strict) {
if (!check_freqs(cmd.mask, freqs.new, data)) { if (!check_freqs(cmd.mask, freqs.new, data)) {
dprintk("acpi_cpufreq_target failed (%d)\n", dprintk("acpi_cpufreq_target failed (%d)\n",
policy->cpu); policy->cpu);
return -EAGAIN; return -EAGAIN;
} }
} }
@ -395,10 +390,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
return result; return result;
} }
static int acpi_cpufreq_verify(struct cpufreq_policy *policy)
static int
acpi_cpufreq_verify (
struct cpufreq_policy *policy)
{ {
struct acpi_cpufreq_data *data = drv_data[policy->cpu]; struct acpi_cpufreq_data *data = drv_data[policy->cpu];
@ -407,13 +399,10 @@ acpi_cpufreq_verify (
return cpufreq_frequency_table_verify(policy, data->freq_table); return cpufreq_frequency_table_verify(policy, data->freq_table);
} }
static unsigned long static unsigned long
acpi_cpufreq_guess_freq ( acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
struct acpi_cpufreq_data *data,
unsigned int cpu)
{ {
struct acpi_processor_performance *perf = data->acpi_data; struct acpi_processor_performance *perf = data->acpi_data;
if (cpu_khz) { if (cpu_khz) {
/* search the closest match to cpu_khz */ /* search the closest match to cpu_khz */
@ -423,14 +412,14 @@ acpi_cpufreq_guess_freq (
for (i = 0; i < (perf->state_count - 1); i++) { for (i = 0; i < (perf->state_count - 1); i++) {
freq = freqn; freq = freqn;
freqn = perf->states[i+1].core_frequency * 1000; freqn = perf->states[i + 1].core_frequency * 1000;
if ((2 * cpu_khz) > (freqn + freq)) { if ((2 * cpu_khz) > (freqn + freq)) {
perf->state = i; perf->state = i;
return (freq); return freq;
} }
} }
perf->state = perf->state_count - 1; perf->state = perf->state_count - 1;
return (freqn); return freqn;
} else { } else {
/* assume CPU is at P0... */ /* assume CPU is at P0... */
perf->state = 0; perf->state = 0;
@ -438,7 +427,6 @@ acpi_cpufreq_guess_freq (
} }
} }
/* /*
* acpi_cpufreq_early_init - initialize ACPI P-States library * acpi_cpufreq_early_init - initialize ACPI P-States library
* *
@ -449,21 +437,21 @@ acpi_cpufreq_guess_freq (
*/ */
static int acpi_cpufreq_early_init(void) static int acpi_cpufreq_early_init(void)
{ {
struct acpi_processor_performance *data; struct acpi_processor_performance *data;
cpumask_t covered; cpumask_t covered;
unsigned int i, j; unsigned int i, j;
dprintk("acpi_cpufreq_early_init\n"); dprintk("acpi_cpufreq_early_init\n");
for_each_possible_cpu(i) { for_each_possible_cpu(i) {
data = kzalloc(sizeof(struct acpi_processor_performance), data = kzalloc(sizeof(struct acpi_processor_performance),
GFP_KERNEL); GFP_KERNEL);
if (!data) { if (!data) {
for_each_cpu_mask(j, covered) { for_each_cpu_mask(j, covered) {
kfree(acpi_perf_data[j]); kfree(acpi_perf_data[j]);
acpi_perf_data[j] = NULL; acpi_perf_data[j] = NULL;
} }
return (-ENOMEM); return -ENOMEM;
} }
acpi_perf_data[i] = data; acpi_perf_data[i] = data;
cpu_set(i, covered); cpu_set(i, covered);
@ -501,27 +489,25 @@ static struct dmi_system_id sw_any_bug_dmi_table[] = {
{ } { }
}; };
static int static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
acpi_cpufreq_cpu_init (
struct cpufreq_policy *policy)
{ {
unsigned int i; unsigned int i;
unsigned int valid_states = 0; unsigned int valid_states = 0;
unsigned int cpu = policy->cpu; unsigned int cpu = policy->cpu;
struct acpi_cpufreq_data *data; struct acpi_cpufreq_data *data;
unsigned int l, h; unsigned int l, h;
unsigned int result = 0; unsigned int result = 0;
struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
struct acpi_processor_performance *perf; struct acpi_processor_performance *perf;
dprintk("acpi_cpufreq_cpu_init\n"); dprintk("acpi_cpufreq_cpu_init\n");
if (!acpi_perf_data[cpu]) if (!acpi_perf_data[cpu])
return (-ENODEV); return -ENODEV;
data = kzalloc(sizeof(struct acpi_cpufreq_data), GFP_KERNEL); data = kzalloc(sizeof(struct acpi_cpufreq_data), GFP_KERNEL);
if (!data) if (!data)
return (-ENOMEM); return -ENOMEM;
data->acpi_data = acpi_perf_data[cpu]; data->acpi_data = acpi_perf_data[cpu];
drv_data[cpu] = data; drv_data[cpu] = data;
@ -566,11 +552,11 @@ acpi_cpufreq_cpu_init (
} }
switch (perf->control_register.space_id) { switch (perf->control_register.space_id) {
case ACPI_ADR_SPACE_SYSTEM_IO: case ACPI_ADR_SPACE_SYSTEM_IO:
dprintk("SYSTEM IO addr space\n"); dprintk("SYSTEM IO addr space\n");
data->cpu_feature = SYSTEM_IO_CAPABLE; data->cpu_feature = SYSTEM_IO_CAPABLE;
break; break;
case ACPI_ADR_SPACE_FIXED_HARDWARE: case ACPI_ADR_SPACE_FIXED_HARDWARE:
dprintk("HARDWARE addr space\n"); dprintk("HARDWARE addr space\n");
if (!check_est_cpu(cpu)) { if (!check_est_cpu(cpu)) {
result = -ENODEV; result = -ENODEV;
@ -578,14 +564,16 @@ acpi_cpufreq_cpu_init (
} }
data->cpu_feature = SYSTEM_INTEL_MSR_CAPABLE; data->cpu_feature = SYSTEM_INTEL_MSR_CAPABLE;
break; break;
default: default:
dprintk("Unknown addr space %d\n", dprintk("Unknown addr space %d\n",
(u32) (perf->control_register.space_id)); (u32) (perf->control_register.space_id));
result = -ENODEV; result = -ENODEV;
goto err_unreg; goto err_unreg;
} }
data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * (perf->state_count + 1), GFP_KERNEL); data->freq_table =
kmalloc(sizeof(struct cpufreq_frequency_table) *
(perf->state_count + 1), GFP_KERNEL);
if (!data->freq_table) { if (!data->freq_table) {
result = -ENOMEM; result = -ENOMEM;
goto err_unreg; goto err_unreg;
@ -593,22 +581,23 @@ acpi_cpufreq_cpu_init (
/* detect transition latency */ /* detect transition latency */
policy->cpuinfo.transition_latency = 0; policy->cpuinfo.transition_latency = 0;
for (i=0; i<perf->state_count; i++) { for (i = 0; i < perf->state_count; i++) {
if ((perf->states[i].transition_latency * 1000) > policy->cpuinfo.transition_latency) if ((perf->states[i].transition_latency * 1000) >
policy->cpuinfo.transition_latency = perf->states[i].transition_latency * 1000; policy->cpuinfo.transition_latency)
policy->cpuinfo.transition_latency =
perf->states[i].transition_latency * 1000;
} }
policy->governor = CPUFREQ_DEFAULT_GOVERNOR; policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
/* table init */ /* table init */
for (i=0; i<perf->state_count; i++) for (i = 0; i < perf->state_count; i++) {
{ if (i > 0 && perf->states[i].core_frequency ==
if ( i > 0 && perf->states[i].core_frequency == perf->states[i - 1].core_frequency)
perf->states[i - 1].core_frequency)
continue; continue;
data->freq_table[valid_states].index = i; data->freq_table[valid_states].index = i;
data->freq_table[valid_states].frequency = data->freq_table[valid_states].frequency =
perf->states[i].core_frequency * 1000; perf->states[i].core_frequency * 1000;
valid_states++; valid_states++;
} }
data->freq_table[perf->state_count].frequency = CPUFREQ_TABLE_END; data->freq_table[perf->state_count].frequency = CPUFREQ_TABLE_END;
@ -619,14 +608,14 @@ acpi_cpufreq_cpu_init (
} }
switch (data->cpu_feature) { switch (data->cpu_feature) {
case ACPI_ADR_SPACE_SYSTEM_IO: case ACPI_ADR_SPACE_SYSTEM_IO:
/* Current speed is unknown and not detectable by IO port */ /* Current speed is unknown and not detectable by IO port */
policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu); policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu);
break; break;
case ACPI_ADR_SPACE_FIXED_HARDWARE: case ACPI_ADR_SPACE_FIXED_HARDWARE:
get_cur_freq_on_cpu(cpu); get_cur_freq_on_cpu(cpu);
break; break;
default: default:
break; break;
} }
@ -636,7 +625,7 @@ acpi_cpufreq_cpu_init (
dprintk("CPU%u - ACPI performance management activated.\n", cpu); dprintk("CPU%u - ACPI performance management activated.\n", cpu);
for (i = 0; i < perf->state_count; i++) for (i = 0; i < perf->state_count; i++)
dprintk(" %cP%d: %d MHz, %d mW, %d uS\n", dprintk(" %cP%d: %d MHz, %d mW, %d uS\n",
(i == perf->state?'*':' '), i, (i == perf->state ? '*' : ' '), i,
(u32) perf->states[i].core_frequency, (u32) perf->states[i].core_frequency,
(u32) perf->states[i].power, (u32) perf->states[i].power,
(u32) perf->states[i].transition_latency); (u32) perf->states[i].transition_latency);
@ -651,85 +640,74 @@ acpi_cpufreq_cpu_init (
return result; return result;
err_freqfree: err_freqfree:
kfree(data->freq_table); kfree(data->freq_table);
err_unreg: err_unreg:
acpi_processor_unregister_performance(perf, cpu); acpi_processor_unregister_performance(perf, cpu);
err_free: err_free:
kfree(data); kfree(data);
drv_data[cpu] = NULL; drv_data[cpu] = NULL;
return (result); return result;
} }
static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
static int
acpi_cpufreq_cpu_exit (
struct cpufreq_policy *policy)
{ {
struct acpi_cpufreq_data *data = drv_data[policy->cpu]; struct acpi_cpufreq_data *data = drv_data[policy->cpu];
dprintk("acpi_cpufreq_cpu_exit\n"); dprintk("acpi_cpufreq_cpu_exit\n");
if (data) { if (data) {
cpufreq_frequency_table_put_attr(policy->cpu); cpufreq_frequency_table_put_attr(policy->cpu);
drv_data[policy->cpu] = NULL; drv_data[policy->cpu] = NULL;
acpi_processor_unregister_performance(data->acpi_data, policy->cpu); acpi_processor_unregister_performance(data->acpi_data,
policy->cpu);
kfree(data); kfree(data);
} }
return (0); return 0;
} }
static int static int acpi_cpufreq_resume(struct cpufreq_policy *policy)
acpi_cpufreq_resume (
struct cpufreq_policy *policy)
{ {
struct acpi_cpufreq_data *data = drv_data[policy->cpu]; struct acpi_cpufreq_data *data = drv_data[policy->cpu];
dprintk("acpi_cpufreq_resume\n"); dprintk("acpi_cpufreq_resume\n");
data->resume = 1; data->resume = 1;
return (0); return 0;
} }
static struct freq_attr *acpi_cpufreq_attr[] = {
static struct freq_attr* acpi_cpufreq_attr[] = {
&cpufreq_freq_attr_scaling_available_freqs, &cpufreq_freq_attr_scaling_available_freqs,
NULL, NULL,
}; };
static struct cpufreq_driver acpi_cpufreq_driver = { static struct cpufreq_driver acpi_cpufreq_driver = {
.verify = acpi_cpufreq_verify, .verify = acpi_cpufreq_verify,
.target = acpi_cpufreq_target, .target = acpi_cpufreq_target,
.get = get_cur_freq_on_cpu, .get = get_cur_freq_on_cpu,
.init = acpi_cpufreq_cpu_init, .init = acpi_cpufreq_cpu_init,
.exit = acpi_cpufreq_cpu_exit, .exit = acpi_cpufreq_cpu_exit,
.resume = acpi_cpufreq_resume, .resume = acpi_cpufreq_resume,
.name = "acpi-cpufreq", .name = "acpi-cpufreq",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.attr = acpi_cpufreq_attr, .attr = acpi_cpufreq_attr,
}; };
static int __init acpi_cpufreq_init(void)
static int __init
acpi_cpufreq_init (void)
{ {
dprintk("acpi_cpufreq_init\n"); dprintk("acpi_cpufreq_init\n");
acpi_cpufreq_early_init(); acpi_cpufreq_early_init();
return cpufreq_register_driver(&acpi_cpufreq_driver); return cpufreq_register_driver(&acpi_cpufreq_driver);
} }
static void __exit acpi_cpufreq_exit(void)
static void __exit
acpi_cpufreq_exit (void)
{ {
unsigned int i; unsigned int i;
dprintk("acpi_cpufreq_exit\n"); dprintk("acpi_cpufreq_exit\n");
cpufreq_unregister_driver(&acpi_cpufreq_driver); cpufreq_unregister_driver(&acpi_cpufreq_driver);
@ -742,7 +720,8 @@ acpi_cpufreq_exit (void)
} }
module_param(acpi_pstate_strict, uint, 0644); module_param(acpi_pstate_strict, uint, 0644);
MODULE_PARM_DESC(acpi_pstate_strict, "value 0 or non-zero. non-zero -> strict ACPI checks are performed during frequency changes."); MODULE_PARM_DESC(acpi_pstate_strict,
"value 0 or non-zero. non-zero -> strict ACPI checks are performed during frequency changes.");
late_initcall(acpi_cpufreq_init); late_initcall(acpi_cpufreq_init);
module_exit(acpi_cpufreq_exit); module_exit(acpi_cpufreq_exit);