Skip to content

Commit

Permalink
clk: migrate ref counts when orphans are reunited
Browse files Browse the repository at this point in the history
It's always nice to see families reunited, and this is equally true when
talking about parent clocks and their children. However, if the orphan
clk had a positive prepare_count or enable_count, then we would not
migrate those counts up the parent chain correctly.

This has manifested with the recent critical clocks feature, which often
enables clocks very early, before their parents have been registered.

Fixed by replacing the call to clk_core_reparent with calls to
__clk_set_parent_{before,after}.

Cc: James Liao <[email protected]>
Cc: Erin Lo <[email protected]>
Signed-off-by: Michael Turquette <[email protected]>
[[email protected]: Recalc accuracies and rates too]
Signed-off-by: Stephen Boyd <[email protected]>
  • Loading branch information
mturquette authored and bebarino committed Aug 12, 2016
1 parent e0cb1b8 commit 904e6ea
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/clk/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2449,8 +2449,16 @@ static int __clk_core_init(struct clk_core *core)
hlist_for_each_entry_safe(orphan, tmp2, &clk_orphan_list, child_node) {
struct clk_core *parent = __clk_init_parent(orphan);

if (parent)
clk_core_reparent(orphan, parent);
/*
* we could call __clk_set_parent, but that would result in a
* redundant call to the .set_rate op, if it exists
*/
if (parent) {
__clk_set_parent_before(orphan, parent);
__clk_set_parent_after(orphan, parent, NULL);
__clk_recalc_accuracies(orphan);
__clk_recalc_rates(orphan, 0);
}
}

/*
Expand Down

0 comments on commit 904e6ea

Please sign in to comment.