From: Masahiro Yamada Date: Tue, 5 Jan 2016 03:43:41 +0000 (+0900) Subject: clk: optimize the divider walk in clk_divider_bestdiv() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=653d1452b452207999b67ab943c27cd80b7bd430;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Stephen Boyd --- diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 7d62dc30e969..00e035b51c69 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -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