clk: optimize the divider walk in clk_divider_bestdiv()
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 5 Jan 2016 03:43:41 +0000 (12:43 +0900)
committerStephen Boyd <sboyd@codeaurora.org>
Sat, 30 Jan 2016 00:45:32 +0000 (16:45 -0800)
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>
drivers/clk/clk-divider.c

index 7d62dc30e969e2d7b15c21ae7e086ee56514a6a4..00e035b51c695be31a215319fd3af62fcd72112d 100644 (file)
@@ -303,9 +303,8 @@ static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
         */
        maxdiv = min(ULONG_MAX / rate, maxdiv);
 
-       for (i = 1; i <= maxdiv; i = _next_div(table, i, flags)) {
-               if (!_is_valid_div(table, i, flags))
-                       continue;
+       for (i = _next_div(table, 0, flags); i <= maxdiv;
+                                            i = _next_div(table, i, flags)) {
                if (rate * i == parent_rate_saved) {
                        /*
                         * It's the most ideal case if the requested rate can be