提交 470b5e2f 编写于 作者: M Masahiro Yamada 提交者: Stephen Boyd

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: NMasahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: NVladimir Zapolskiy <vz@mleia.com>
Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
上级 508f884a
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册