clk: migrate ref counts when orphans are reunited
authorMichael Turquette <mturquette@baylibre.com>
Fri, 8 Jul 2016 23:32:10 +0000 (16:32 -0700)
committerStephen Boyd <sboyd@codeaurora.org>
Fri, 12 Aug 2016 01:06:50 +0000 (18:06 -0700)
commit904e6ead02dcb409cb6eb5ec1c31dc2c7c28b5df
treec81655dfc23146f3a85d74ffacc71f036fab97c9
parente0cb1b84163720ec67ff0e54397fd3f57ad4a4dd
clk: migrate ref counts when orphans are reunited

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 <jamesjj.liao@mediatek.com>
Cc: Erin Lo <erin.lo@mediatek.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
[sboyd@codeaurora.org: Recalc accuracies and rates too]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/clk.c