Skip to content

Commit 2f48802

Browse files
committed
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq
* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq: [CPUFREQ] powernow-k8: Don't try to transition if the pstate is incorrect [CPUFREQ] powernow-k8: Don't notify of successful transition if we failed (vid case). [CPUFREQ] Don't set stat->last_index to -1 if the pol->cur has incorrect value.
2 parents 95559f2 + fbb5b89 commit 2f48802

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

drivers/cpufreq/cpufreq_stats.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,13 @@ static int cpufreq_stat_notifier_trans(struct notifier_block *nb,
298298
old_index = stat->last_index;
299299
new_index = freq_table_get_index(stat, freq->new);
300300

301-
cpufreq_stats_update(freq->cpu);
302-
if (old_index == new_index)
301+
/* We can't do stat->time_in_state[-1]= .. */
302+
if (old_index == -1 || new_index == -1)
303303
return 0;
304304

305-
if (old_index == -1 || new_index == -1)
305+
cpufreq_stats_update(freq->cpu);
306+
307+
if (old_index == new_index)
306308
return 0;
307309

308310
spin_lock(&cpufreq_stats_lock);

drivers/cpufreq/powernow-k8.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,9 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data,
10791079
}
10801080

10811081
res = transition_fid_vid(data, fid, vid);
1082+
if (res)
1083+
return res;
1084+
10821085
freqs.new = find_khz_freq_from_fid(data->currfid);
10831086

10841087
for_each_cpu(i, data->available_cores) {
@@ -1101,7 +1104,8 @@ static int transition_frequency_pstate(struct powernow_k8_data *data,
11011104
/* get MSR index for hardware pstate transition */
11021105
pstate = index & HW_PSTATE_MASK;
11031106
if (pstate > data->max_hw_pstate)
1104-
return 0;
1107+
return -EINVAL;
1108+
11051109
freqs.old = find_khz_freq_from_pstate(data->powernow_table,
11061110
data->currpstate);
11071111
freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);

0 commit comments

Comments
 (0)