diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2015-12-28 19:23:09 +0900 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2016-02-02 11:53:16 -0800 |
commit | 470b5e2f97cf8fb6a8375cc59e86314c9dd354c2 (patch) | |
tree | fc781468a6e802aad430da86a3099cd6b27d3ef0 /drivers/clk/clk.c | |
parent | 508f884a66abb61f22fcc2b36ab1e68492f1d295 (diff) | |
download | linux-470b5e2f97cf8fb6a8375cc59e86314c9dd354c2.tar.bz2 |
clk: simplify clk_fetch_parent_index() function
The clk_core_get_parent_by_index can be used as a helper function
to simplify the implementation of clk_fetch_parent_index().
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r-- | drivers/clk/clk.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index da7c9a523f02..82b79a6ec0ec 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1069,23 +1069,9 @@ static int clk_fetch_parent_index(struct clk_core *core, if (!parent) return -EINVAL; - /* - * find index of new parent clock using cached parent ptrs, - * or if not yet cached, use string name comparison and cache - * them now to avoid future calls to clk_core_lookup. - */ - for (i = 0; i < core->num_parents; i++) { - if (core->parents[i] == parent) - return i; - - if (core->parents[i]) - continue; - - if (!strcmp(core->parent_names[i], parent->name)) { - core->parents[i] = clk_core_lookup(parent->name); + for (i = 0; i < core->num_parents; i++) + if (clk_core_get_parent_by_index(core, i) == parent) return i; - } - } return -EINVAL; } |