sh: clkfwk: Fix up checkpatch warnings.
The clk_round_parent() change introduced various checkpatch warnings, tidy them up. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
d0013c9e3b
commit
a766b29790
@ -561,57 +561,74 @@ long clk_round_parent(struct clk *clk, unsigned long target,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (unlikely(freq->frequency / target <= div_min - 1)) {
|
if (unlikely(freq->frequency / target <= div_min - 1)) {
|
||||||
unsigned long freq_max = (freq->frequency + div_min / 2) / div_min;
|
unsigned long freq_max;
|
||||||
|
|
||||||
|
freq_max = (freq->frequency + div_min / 2) / div_min;
|
||||||
if (error > target - freq_max) {
|
if (error > target - freq_max) {
|
||||||
error = target - freq_max;
|
error = target - freq_max;
|
||||||
best = freq;
|
best = freq;
|
||||||
if (best_freq)
|
if (best_freq)
|
||||||
*best_freq = freq_max;
|
*best_freq = freq_max;
|
||||||
}
|
}
|
||||||
pr_debug("too low freq %lu, error %lu\n", freq->frequency, target - freq_max);
|
|
||||||
|
pr_debug("too low freq %lu, error %lu\n", freq->frequency,
|
||||||
|
target - freq_max);
|
||||||
|
|
||||||
if (!error)
|
if (!error)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(freq->frequency / target >= div_max)) {
|
if (unlikely(freq->frequency / target >= div_max)) {
|
||||||
unsigned long freq_min = (freq->frequency + div_max / 2) / div_max;
|
unsigned long freq_min;
|
||||||
|
|
||||||
|
freq_min = (freq->frequency + div_max / 2) / div_max;
|
||||||
if (error > freq_min - target) {
|
if (error > freq_min - target) {
|
||||||
error = freq_min - target;
|
error = freq_min - target;
|
||||||
best = freq;
|
best = freq;
|
||||||
if (best_freq)
|
if (best_freq)
|
||||||
*best_freq = freq_min;
|
*best_freq = freq_min;
|
||||||
}
|
}
|
||||||
pr_debug("too high freq %lu, error %lu\n", freq->frequency, freq_min - target);
|
|
||||||
|
pr_debug("too high freq %lu, error %lu\n", freq->frequency,
|
||||||
|
freq_min - target);
|
||||||
|
|
||||||
if (!error)
|
if (!error)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
div = freq->frequency / target;
|
div = freq->frequency / target;
|
||||||
freq_high = freq->frequency / div;
|
freq_high = freq->frequency / div;
|
||||||
freq_low = freq->frequency / (div + 1);
|
freq_low = freq->frequency / (div + 1);
|
||||||
|
|
||||||
if (freq_high - target < error) {
|
if (freq_high - target < error) {
|
||||||
error = freq_high - target;
|
error = freq_high - target;
|
||||||
best = freq;
|
best = freq;
|
||||||
if (best_freq)
|
if (best_freq)
|
||||||
*best_freq = freq_high;
|
*best_freq = freq_high;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target - freq_low < error) {
|
if (target - freq_low < error) {
|
||||||
error = target - freq_low;
|
error = target - freq_low;
|
||||||
best = freq;
|
best = freq;
|
||||||
if (best_freq)
|
if (best_freq)
|
||||||
*best_freq = freq_low;
|
*best_freq = freq_low;
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_debug("%u / %lu = %lu, / %lu = %lu, best %lu, parent %u\n",
|
pr_debug("%u / %lu = %lu, / %lu = %lu, best %lu, parent %u\n",
|
||||||
freq->frequency, div, freq_high, div + 1, freq_low,
|
freq->frequency, div, freq_high, div + 1, freq_low,
|
||||||
*best_freq, best->frequency);
|
*best_freq, best->frequency);
|
||||||
|
|
||||||
if (!error)
|
if (!error)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent_freq)
|
if (parent_freq)
|
||||||
*parent_freq = best->frequency;
|
*parent_freq = best->frequency;
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(clk_round_parent);
|
EXPORT_SYMBOL_GPL(clk_round_parent);
|
||||||
|
Loading…
Reference in New Issue
Block a user