Skip to contentSkip to conversation

cpufreq: acpi-cpufreq: Eliminate get of current freq on notification

PATCH In review Venkatesh Pallipadi 2 participants 2 messages Oct 1, 2006 – Oct 2, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 6/8 cpufreq: acpi-cpufreq: Eliminate get of current freq on notification

Only change the frequency if the state previously set is different from what we are trying to set. We don't really have to get the current frequency at this point.

arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +3 -4
Index: linux-2.6.18/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
===================================================================
@@ -325,11 +325,8 @@ static int acpi_cpufreq_target(struct cp
 	online_policy_cpus = policy->cpus;
 #endif
 
-	cmd.val = get_cur_val(online_policy_cpus);
-	freqs.old = extract_freq(cmd.val, data);
-	freqs.new = data->freq_table[next_state].frequency;
 	next_perf_state = data->freq_table[next_state].index;
-	if (freqs.new == freqs.old) {
+	if (perf->state == next_perf_state) {
 		if (unlikely(data->resume)) {
 			dprintk("Called after resume, resetting to P%d\n",
 				next_perf_state);
@@ -367,6 +364,8 @@ static int acpi_cpufreq_target(struct cp
 	else
 		cpu_set(policy->cpu, cmd.mask);
 
+	freqs.old = data->freq_table[perf->state].frequency;
+	freqs.new = data->freq_table[next_perf_state].frequency;
 	for_each_cpu_mask(i, cmd.mask) {
 		freqs.cpu = i;
 		cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
#1 lore raw

Hi,

Quoted 3 lines · Venkatesh Pallipadi

Only change the frequency if the state previously set is different from what we are trying to set. We don't really have to get the current frequency at this point.

What if it changed behind our back? Shouldn't happen, I know, but it does happen.

Dominik