Commit 76374783 authored by Dave Jones's avatar Dave Jones

[CPUFREQ] Clean up clock_ratio calculation.

parent 2798b95d
...@@ -303,10 +303,10 @@ static void longhaul_setstate (unsigned int clock_ratio_index) ...@@ -303,10 +303,10 @@ static void longhaul_setstate (unsigned int clock_ratio_index)
union msr_longhaul longhaul; union msr_longhaul longhaul;
union msr_bcr2 bcr2; union msr_bcr2 bcr2;
if (clock_ratio[clock_ratio_index] == -1) mult = clock_ratio[clock_ratio_index];
if (mult == -1)
return; return;
mult = clock_ratio[clock_ratio_index];
speed = calc_speed (mult, fsb); speed = calc_speed (mult, fsb);
if ((speed > highest_speed) || (speed < lowest_speed)) if ((speed > highest_speed) || (speed < lowest_speed))
return; return;
...@@ -450,12 +450,14 @@ static int __init longhaul_get_ranges (void) ...@@ -450,12 +450,14 @@ static int __init longhaul_get_ranges (void)
if(!longhaul_table) if(!longhaul_table)
return -ENOMEM; return -ENOMEM;
for (j=0; (j<numscales); j++) { for (j=0; j < numscales; j++) {
if (clock_ratio[j] == -1) unsigned int ratio;
ratio = clock_ratio[j];
if (ratio == -1)
continue; continue;
if (((unsigned int)clock_ratio[j] > maxmult) || ((unsigned int)clock_ratio[j] < minmult)) if (ratio > maxmult || ratio < minmult)
continue; continue;
longhaul_table[k].frequency = calc_speed (clock_ratio[j], fsb); longhaul_table[k].frequency = calc_speed (ratio, fsb);
longhaul_table[k].index = (j << 8); longhaul_table[k].index = (j << 8);
k++; k++;
} }
......
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