Commit 3be1394a authored by Viresh Kumar's avatar Viresh Kumar Committed by Rafael J. Wysocki

cpufreq: speedstep: Use generic cpufreq routines

Most of the CPUFreq drivers do similar things in .exit() and .verify() routines
and .attr. So its better if we have generic routines for them which can be used
by cpufreq drivers then.

This patch uses these generic routines in the speedstep driver.

Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent e2132fa6
...@@ -419,19 +419,6 @@ static int centrino_cpu_exit(struct cpufreq_policy *policy) ...@@ -419,19 +419,6 @@ static int centrino_cpu_exit(struct cpufreq_policy *policy)
return 0; return 0;
} }
/**
* centrino_verify - verifies a new CPUFreq policy
* @policy: new policy
*
* Limit must be within this model's frequency range at least one
* border included.
*/
static int centrino_verify (struct cpufreq_policy *policy)
{
return cpufreq_frequency_table_verify(policy,
per_cpu(centrino_model, policy->cpu)->op_points);
}
/** /**
* centrino_setpolicy - set a new CPUFreq policy * centrino_setpolicy - set a new CPUFreq policy
* @policy: new policy * @policy: new policy
...@@ -553,20 +540,15 @@ static int centrino_target (struct cpufreq_policy *policy, ...@@ -553,20 +540,15 @@ static int centrino_target (struct cpufreq_policy *policy,
return retval; return retval;
} }
static struct freq_attr* centrino_attr[] = {
&cpufreq_freq_attr_scaling_available_freqs,
NULL,
};
static struct cpufreq_driver centrino_driver = { static struct cpufreq_driver centrino_driver = {
.name = "centrino", /* should be speedstep-centrino, .name = "centrino", /* should be speedstep-centrino,
but there's a 16 char limit */ but there's a 16 char limit */
.init = centrino_cpu_init, .init = centrino_cpu_init,
.exit = centrino_cpu_exit, .exit = centrino_cpu_exit,
.verify = centrino_verify, .verify = cpufreq_generic_frequency_table_verify,
.target = centrino_target, .target = centrino_target,
.get = get_cur_freq, .get = get_cur_freq,
.attr = centrino_attr, .attr = cpufreq_generic_attr,
}; };
/* /*
......
...@@ -289,18 +289,6 @@ static int speedstep_target(struct cpufreq_policy *policy, ...@@ -289,18 +289,6 @@ static int speedstep_target(struct cpufreq_policy *policy,
} }
/**
* speedstep_verify - verifies a new CPUFreq policy
* @policy: new policy
*
* Limit must be within speedstep_low_freq and speedstep_high_freq, with
* at least one border included.
*/
static int speedstep_verify(struct cpufreq_policy *policy)
{
return cpufreq_frequency_table_verify(policy, &speedstep_freqs[0]);
}
struct get_freqs { struct get_freqs {
struct cpufreq_policy *policy; struct cpufreq_policy *policy;
int ret; int ret;
...@@ -352,26 +340,14 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) ...@@ -352,26 +340,14 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
} }
static int speedstep_cpu_exit(struct cpufreq_policy *policy)
{
cpufreq_frequency_table_put_attr(policy->cpu);
return 0;
}
static struct freq_attr *speedstep_attr[] = {
&cpufreq_freq_attr_scaling_available_freqs,
NULL,
};
static struct cpufreq_driver speedstep_driver = { static struct cpufreq_driver speedstep_driver = {
.name = "speedstep-ich", .name = "speedstep-ich",
.verify = speedstep_verify, .verify = cpufreq_generic_frequency_table_verify,
.target = speedstep_target, .target = speedstep_target,
.init = speedstep_cpu_init, .init = speedstep_cpu_init,
.exit = speedstep_cpu_exit, .exit = cpufreq_generic_exit,
.get = speedstep_get, .get = speedstep_get,
.attr = speedstep_attr, .attr = cpufreq_generic_attr,
}; };
static const struct x86_cpu_id ss_smi_ids[] = { static const struct x86_cpu_id ss_smi_ids[] = {
......
...@@ -264,19 +264,6 @@ static int speedstep_target(struct cpufreq_policy *policy, ...@@ -264,19 +264,6 @@ static int speedstep_target(struct cpufreq_policy *policy,
} }
/**
* speedstep_verify - verifies a new CPUFreq policy
* @policy: new policy
*
* Limit must be within speedstep_low_freq and speedstep_high_freq, with
* at least one border included.
*/
static int speedstep_verify(struct cpufreq_policy *policy)
{
return cpufreq_frequency_table_verify(policy, &speedstep_freqs[0]);
}
static int speedstep_cpu_init(struct cpufreq_policy *policy) static int speedstep_cpu_init(struct cpufreq_policy *policy)
{ {
int result; int result;
...@@ -332,12 +319,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) ...@@ -332,12 +319,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
return cpufreq_table_validate_and_show(policy, speedstep_freqs); return cpufreq_table_validate_and_show(policy, speedstep_freqs);
} }
static int speedstep_cpu_exit(struct cpufreq_policy *policy)
{
cpufreq_frequency_table_put_attr(policy->cpu);
return 0;
}
static unsigned int speedstep_get(unsigned int cpu) static unsigned int speedstep_get(unsigned int cpu)
{ {
if (cpu) if (cpu)
...@@ -356,20 +337,15 @@ static int speedstep_resume(struct cpufreq_policy *policy) ...@@ -356,20 +337,15 @@ static int speedstep_resume(struct cpufreq_policy *policy)
return result; return result;
} }
static struct freq_attr *speedstep_attr[] = {
&cpufreq_freq_attr_scaling_available_freqs,
NULL,
};
static struct cpufreq_driver speedstep_driver = { static struct cpufreq_driver speedstep_driver = {
.name = "speedstep-smi", .name = "speedstep-smi",
.verify = speedstep_verify, .verify = cpufreq_generic_frequency_table_verify,
.target = speedstep_target, .target = speedstep_target,
.init = speedstep_cpu_init, .init = speedstep_cpu_init,
.exit = speedstep_cpu_exit, .exit = cpufreq_generic_exit,
.get = speedstep_get, .get = speedstep_get,
.resume = speedstep_resume, .resume = speedstep_resume,
.attr = speedstep_attr, .attr = cpufreq_generic_attr,
}; };
static const struct x86_cpu_id ss_smi_ids[] = { static const struct x86_cpu_id ss_smi_ids[] = {
......
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