Skip to content

Commit

Permalink
cpufreq: s3cx4xx: Use generic cpufreq routines
Browse files Browse the repository at this point in the history
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 s3cx4xx driver.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Viresh Kumar authored and Rafael J. Wysocki committed Oct 15, 2013
1 parent bf36e48 commit e96a410
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 35 deletions.
19 changes: 2 additions & 17 deletions drivers/cpufreq/s3c2416-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,6 @@ static struct cpufreq_frequency_table s3c2450_freq_table[] = {
{ 0, CPUFREQ_TABLE_END },
};

static int s3c2416_cpufreq_verify_speed(struct cpufreq_policy *policy)
{
struct s3c2416_data *s3c_freq = &s3c2416_cpufreq;

if (policy->cpu != 0)
return -EINVAL;

return cpufreq_frequency_table_verify(policy, s3c_freq->freq_table);
}

static unsigned int s3c2416_cpufreq_get_speed(unsigned int cpu)
{
struct s3c2416_data *s3c_freq = &s3c2416_cpufreq;
Expand Down Expand Up @@ -516,19 +506,14 @@ static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
return ret;
}

static struct freq_attr *s3c2416_cpufreq_attr[] = {
&cpufreq_freq_attr_scaling_available_freqs,
NULL,
};

static struct cpufreq_driver s3c2416_cpufreq_driver = {
.flags = 0,
.verify = s3c2416_cpufreq_verify_speed,
.verify = cpufreq_generic_frequency_table_verify,
.target = s3c2416_cpufreq_set_target,
.get = s3c2416_cpufreq_get_speed,
.init = s3c2416_cpufreq_driver_init,
.name = "s3c2416",
.attr = s3c2416_cpufreq_attr,
.attr = cpufreq_generic_attr,
};

static int __init s3c2416_cpufreq_init(void)
Expand Down
9 changes: 0 additions & 9 deletions drivers/cpufreq/s3c24xx-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,14 +416,6 @@ static int __init s3c_cpufreq_initclks(void)
return 0;
}

static int s3c_cpufreq_verify(struct cpufreq_policy *policy)
{
if (policy->cpu != 0)
return -EINVAL;

return 0;
}

#ifdef CONFIG_PM
static struct cpufreq_frequency_table suspend_pll;
static unsigned int suspend_freq;
Expand Down Expand Up @@ -473,7 +465,6 @@ static int s3c_cpufreq_resume(struct cpufreq_policy *policy)

static struct cpufreq_driver s3c24xx_driver = {
.flags = CPUFREQ_STICKY,
.verify = s3c_cpufreq_verify,
.target = s3c_cpufreq_target,
.get = s3c_cpufreq_get,
.init = s3c_cpufreq_init,
Expand Down
10 changes: 1 addition & 9 deletions drivers/cpufreq/s3c64xx-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ static struct cpufreq_frequency_table s3c64xx_freq_table[] = {
};
#endif

static int s3c64xx_cpufreq_verify_speed(struct cpufreq_policy *policy)
{
if (policy->cpu != 0)
return -EINVAL;

return cpufreq_frequency_table_verify(policy, s3c64xx_freq_table);
}

static unsigned int s3c64xx_cpufreq_get_speed(unsigned int cpu)
{
if (cpu != 0)
Expand Down Expand Up @@ -264,7 +256,7 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)

static struct cpufreq_driver s3c64xx_cpufreq_driver = {
.flags = 0,
.verify = s3c64xx_cpufreq_verify_speed,
.verify = cpufreq_generic_frequency_table_verify,
.target = s3c64xx_cpufreq_set_target,
.get = s3c64xx_cpufreq_get_speed,
.init = s3c64xx_cpufreq_driver_init,
Expand Down

0 comments on commit e96a410

Please sign in to comment.