Commit 4efee5ca authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

[CPUFREQ] remove unneeded code

- no cpufreq driver uses the frequency table helper "setpolicy" any more
  ("target" is much more appropriate for them anyways) - so remove
  that helper
- all cpufreq drivers use the advanced registration process, so some
  compatibility code can safely be removed. 
parent d7a27323
...@@ -77,56 +77,6 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, ...@@ -77,56 +77,6 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
EXPORT_SYMBOL_GPL(cpufreq_frequency_table_verify); EXPORT_SYMBOL_GPL(cpufreq_frequency_table_verify);
int cpufreq_frequency_table_setpolicy(struct cpufreq_policy *policy,
struct cpufreq_frequency_table *table,
unsigned int *index)
{
struct cpufreq_frequency_table optimal = { .index = ~0, };
unsigned int i;
switch (policy->policy) {
case CPUFREQ_POLICY_PERFORMANCE:
optimal.frequency = 0;
break;
case CPUFREQ_POLICY_POWERSAVE:
optimal.frequency = ~0;
break;
}
if (!cpu_online(policy->cpu))
return -EINVAL;
for (i=0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
unsigned int freq = table[i].frequency;
if (freq == CPUFREQ_ENTRY_INVALID)
continue;
if ((freq < policy->min) || (freq > policy->max))
continue;
switch(policy->policy) {
case CPUFREQ_POLICY_PERFORMANCE:
if (optimal.frequency <= freq) {
optimal.frequency = freq;
optimal.index = i;
}
break;
case CPUFREQ_POLICY_POWERSAVE:
if (optimal.frequency >= freq) {
optimal.frequency = freq;
optimal.index = i;
}
break;
}
}
if (optimal.index > i)
return -EINVAL;
*index = optimal.index;
return 0;
}
EXPORT_SYMBOL_GPL(cpufreq_frequency_table_setpolicy);
int cpufreq_frequency_table_target(struct cpufreq_policy *policy, int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
struct cpufreq_frequency_table *table, struct cpufreq_frequency_table *table,
unsigned int target_freq, unsigned int target_freq,
......
...@@ -172,9 +172,6 @@ struct cpufreq_driver { ...@@ -172,9 +172,6 @@ struct cpufreq_driver {
int cpufreq_register_driver(struct cpufreq_driver *driver_data); int cpufreq_register_driver(struct cpufreq_driver *driver_data);
int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
/* deprecated */
#define cpufreq_register(x) cpufreq_register_driver(x)
#define cpufreq_unregister() cpufreq_unregister_driver(NULL)
void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state); void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state);
...@@ -297,10 +294,6 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, ...@@ -297,10 +294,6 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
struct cpufreq_frequency_table *table); struct cpufreq_frequency_table *table);
int cpufreq_frequency_table_setpolicy(struct cpufreq_policy *policy,
struct cpufreq_frequency_table *table,
unsigned int *index);
int cpufreq_frequency_table_target(struct cpufreq_policy *policy, int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
struct cpufreq_frequency_table *table, struct cpufreq_frequency_table *table,
unsigned int target_freq, unsigned int target_freq,
......
...@@ -798,7 +798,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) ...@@ -798,7 +798,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
if (cpufreq_driver) if (cpufreq_driver)
return -EBUSY; return -EBUSY;
if (!driver_data || !driver_data->verify || if (!driver_data || !driver_data->verify || !driver_data->init ||
((!driver_data->setpolicy) && (!driver_data->target))) ((!driver_data->setpolicy) && (!driver_data->target)))
return -EINVAL; return -EINVAL;
...@@ -806,20 +806,12 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) ...@@ -806,20 +806,12 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
cpufreq_driver = driver_data; cpufreq_driver = driver_data;
cpufreq_driver->policy = kmalloc(NR_CPUS * sizeof(struct cpufreq_policy), GFP_KERNEL);
if (!cpufreq_driver->policy) { if (!cpufreq_driver->policy) {
/* then we need per-CPU init */ up(&cpufreq_driver_sem);
if (!cpufreq_driver->init) { return -ENOMEM;
up(&cpufreq_driver_sem);
return -EINVAL;
}
cpufreq_driver->policy = kmalloc(NR_CPUS * sizeof(struct cpufreq_policy), GFP_KERNEL);
if (!cpufreq_driver->policy) {
up(&cpufreq_driver_sem);
return -ENOMEM;
}
memset(cpufreq_driver->policy, 0, NR_CPUS * sizeof(struct cpufreq_policy));
} }
memset(cpufreq_driver->policy, 0, NR_CPUS * sizeof(struct cpufreq_policy));
up(&cpufreq_driver_sem); up(&cpufreq_driver_sem);
ret = interface_register(&cpufreq_interface); ret = interface_register(&cpufreq_interface);
...@@ -841,8 +833,8 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) ...@@ -841,8 +833,8 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)
{ {
down(&cpufreq_driver_sem); down(&cpufreq_driver_sem);
if (!cpufreq_driver || if (!cpufreq_driver ||
((driver != cpufreq_driver) && (driver != NULL))) { /* compat */ (driver != cpufreq_driver)) {
up(&cpufreq_driver_sem); up(&cpufreq_driver_sem);
return -EINVAL; return -EINVAL;
} }
......
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