mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-15 01:24:33 +00:00
clk: optimize the divider walk in clk_divider_bestdiv()
Because _next_div() returns a valid divider, there is no need to consult _is_valid_div() for the validity of the divider in every iteration. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
This commit is contained in:
parent
090341b0a9
commit
653d1452b4
@ -303,9 +303,8 @@ static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
|
|||||||
*/
|
*/
|
||||||
maxdiv = min(ULONG_MAX / rate, maxdiv);
|
maxdiv = min(ULONG_MAX / rate, maxdiv);
|
||||||
|
|
||||||
for (i = 1; i <= maxdiv; i = _next_div(table, i, flags)) {
|
for (i = _next_div(table, 0, flags); i <= maxdiv;
|
||||||
if (!_is_valid_div(table, i, flags))
|
i = _next_div(table, i, flags)) {
|
||||||
continue;
|
|
||||||
if (rate * i == parent_rate_saved) {
|
if (rate * i == parent_rate_saved) {
|
||||||
/*
|
/*
|
||||||
* It's the most ideal case if the requested rate can be
|
* It's the most ideal case if the requested rate can be
|
||||||
|
Loading…
x
Reference in New Issue
Block a user