diff options
Diffstat (limited to 'drivers/cpufreq/p4-clockmod.c')
| -rw-r--r-- | drivers/cpufreq/p4-clockmod.c | 72 | 
1 files changed, 16 insertions, 56 deletions
diff --git a/drivers/cpufreq/p4-clockmod.c b/drivers/cpufreq/p4-clockmod.c index 2f0a2a65c37..529cfd92158 100644 --- a/drivers/cpufreq/p4-clockmod.c +++ b/drivers/cpufreq/p4-clockmod.c @@ -92,60 +92,34 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)  static struct cpufreq_frequency_table p4clockmod_table[] = { -	{DC_RESV, CPUFREQ_ENTRY_INVALID}, -	{DC_DFLT, 0}, -	{DC_25PT, 0}, -	{DC_38PT, 0}, -	{DC_50PT, 0}, -	{DC_64PT, 0}, -	{DC_75PT, 0}, -	{DC_88PT, 0}, -	{DC_DISABLE, 0}, -	{DC_RESV, CPUFREQ_TABLE_END}, +	{0, DC_RESV, CPUFREQ_ENTRY_INVALID}, +	{0, DC_DFLT, 0}, +	{0, DC_25PT, 0}, +	{0, DC_38PT, 0}, +	{0, DC_50PT, 0}, +	{0, DC_64PT, 0}, +	{0, DC_75PT, 0}, +	{0, DC_88PT, 0}, +	{0, DC_DISABLE, 0}, +	{0, DC_RESV, CPUFREQ_TABLE_END},  }; -static int cpufreq_p4_target(struct cpufreq_policy *policy, -			     unsigned int target_freq, -			     unsigned int relation) +static int cpufreq_p4_target(struct cpufreq_policy *policy, unsigned int index)  { -	unsigned int    newstate = DC_RESV; -	struct cpufreq_freqs freqs;  	int i; -	if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0], -				target_freq, relation, &newstate)) -		return -EINVAL; - -	freqs.old = cpufreq_p4_get(policy->cpu); -	freqs.new = stock_freq * p4clockmod_table[newstate].driver_data / 8; - -	if (freqs.new == freqs.old) -		return 0; - -	/* notifiers */ -	cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); -  	/* run on each logical CPU,  	 * see section 13.15.3 of IA32 Intel Architecture Software  	 * Developer's Manual, Volume 3  	 */  	for_each_cpu(i, policy->cpus) -		cpufreq_p4_setdc(i, p4clockmod_table[newstate].driver_data); - -	/* notifiers */ -	cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); +		cpufreq_p4_setdc(i, p4clockmod_table[index].driver_data);  	return 0;  } -static int cpufreq_p4_verify(struct cpufreq_policy *policy) -{ -	return cpufreq_frequency_table_verify(policy, &p4clockmod_table[0]); -} - -  static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)  {  	if (c->x86 == 0x06) { @@ -230,25 +204,17 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)  		else  			p4clockmod_table[i].frequency = (stock_freq * i)/8;  	} -	cpufreq_frequency_table_get_attr(p4clockmod_table, policy->cpu);  	/* cpuinfo and default policy values */  	/* the transition latency is set to be 1 higher than the maximum  	 * transition latency of the ondemand governor */  	policy->cpuinfo.transition_latency = 10000001; -	policy->cur = stock_freq; -	return cpufreq_frequency_table_cpuinfo(policy, &p4clockmod_table[0]); +	return cpufreq_table_validate_and_show(policy, &p4clockmod_table[0]);  } -static int cpufreq_p4_cpu_exit(struct cpufreq_policy *policy) -{ -	cpufreq_frequency_table_put_attr(policy->cpu); -	return 0; -} -  static unsigned int cpufreq_p4_get(unsigned int cpu)  {  	u32 l, h; @@ -267,19 +233,13 @@ static unsigned int cpufreq_p4_get(unsigned int cpu)  	return stock_freq;  } -static struct freq_attr *p4clockmod_attr[] = { -	&cpufreq_freq_attr_scaling_available_freqs, -	NULL, -}; -  static struct cpufreq_driver p4clockmod_driver = { -	.verify		= cpufreq_p4_verify, -	.target		= cpufreq_p4_target, +	.verify		= cpufreq_generic_frequency_table_verify, +	.target_index	= cpufreq_p4_target,  	.init		= cpufreq_p4_cpu_init, -	.exit		= cpufreq_p4_cpu_exit,  	.get		= cpufreq_p4_get,  	.name		= "p4-clockmod", -	.attr		= p4clockmod_attr, +	.attr		= cpufreq_generic_attr,  };  static const struct x86_cpu_id cpufreq_p4_id[] = {  | 
