summaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk-divider.c
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2016-01-05 12:43:41 +0900
committerStephen Boyd <sboyd@codeaurora.org>2016-01-29 16:45:32 -0800
commit653d1452b452207999b67ab943c27cd80b7bd430 (patch)
tree1efc23d06e71a13f461596fc4c2aa02073caa894 /drivers/clk/clk-divider.c
parent090341b0a95d1f6d762915a75c13b393366f4ab3 (diff)
downloadop-kernel-dev-653d1452b452207999b67ab943c27cd80b7bd430.zip
op-kernel-dev-653d1452b452207999b67ab943c27cd80b7bd430.tar.gz
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>
Diffstat (limited to 'drivers/clk/clk-divider.c')
-rw-r--r--drivers/clk/clk-divider.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index 7d62dc3..00e035b 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
OpenPOWER on IntegriCloud