summaryrefslogtreecommitdiff
path: root/drivers/clk/clk.c
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2015-12-28 19:23:07 +0900
committerStephen Boyd <sboyd@codeaurora.org>2016-02-02 11:53:14 -0800
commit0e8f6e499ebfd3617c81a89778f55fa6c54623e8 (patch)
tree0c99743d31b2a44421349d4084a3114b2a359ae5 /drivers/clk/clk.c
parent858d5881564026cbc4e6f5e25ae878a27df5d4c9 (diff)
clk: walk the orphan clock list more simply
This loop can be much simpler. If a new parent is available for orphan clocks, __clk_init_parent(orphan) can detect it. 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.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 5a1507498e05..03820467fbba 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2422,24 +2422,15 @@ static int __clk_core_init(struct clk_core *core)
core->rate = core->req_rate = rate;
/*
- * walk the list of orphan clocks and reparent any that are children of
- * this clock
+ * walk the list of orphan clocks and reparent any that newly finds a
+ * parent.
*/
hlist_for_each_entry_safe(orphan, tmp2, &clk_orphan_list, child_node) {
- if (orphan->num_parents && orphan->ops->get_parent) {
- i = orphan->ops->get_parent(orphan->hw);
- if (i >= 0 && i < orphan->num_parents &&
- !strcmp(core->name, orphan->parent_names[i]))
- clk_core_reparent(orphan, core);
- continue;
- }
+ struct clk_core *parent = __clk_init_parent(orphan);
- for (i = 0; i < orphan->num_parents; i++)
- if (!strcmp(core->name, orphan->parent_names[i])) {
- clk_core_reparent(orphan, core);
- break;
- }
- }
+ if (parent)
+ clk_core_reparent(orphan, parent);
+ }
/*
* optional platform-specific magic