mirror of
https://gitee.com/openharmony/kernel_linux
synced 2025-05-22 06:36:39 +00:00
sh: remove bogus highest / lowest logic from clock rate rounding
The use of highest and lowest in clk_rate_table_round() is completely bogus and superfluous. Remove it. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
c45f6f1026
commit
088bcc2aff
@ -73,22 +73,14 @@ long clk_rate_table_round(struct clk *clk,
|
|||||||
{
|
{
|
||||||
unsigned long rate_error, rate_error_prev = ~0UL;
|
unsigned long rate_error, rate_error_prev = ~0UL;
|
||||||
unsigned long rate_best_fit = rate;
|
unsigned long rate_best_fit = rate;
|
||||||
unsigned long highest, lowest;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
highest = lowest = 0;
|
|
||||||
|
|
||||||
for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
|
for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
|
||||||
unsigned long freq = freq_table[i].frequency;
|
unsigned long freq = freq_table[i].frequency;
|
||||||
|
|
||||||
if (freq == CPUFREQ_ENTRY_INVALID)
|
if (freq == CPUFREQ_ENTRY_INVALID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (freq > highest)
|
|
||||||
highest = freq;
|
|
||||||
if (freq < lowest)
|
|
||||||
lowest = freq;
|
|
||||||
|
|
||||||
rate_error = abs(freq - rate);
|
rate_error = abs(freq - rate);
|
||||||
if (rate_error < rate_error_prev) {
|
if (rate_error < rate_error_prev) {
|
||||||
rate_best_fit = freq;
|
rate_best_fit = freq;
|
||||||
@ -99,11 +91,6 @@ long clk_rate_table_round(struct clk *clk,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rate >= highest)
|
|
||||||
rate_best_fit = highest;
|
|
||||||
if (rate <= lowest)
|
|
||||||
rate_best_fit = lowest;
|
|
||||||
|
|
||||||
return rate_best_fit;
|
return rate_best_fit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user