Merge branch 'clk-fixes' into clk-next
authorStephen Boyd <sboyd@codeaurora.org>
Tue, 21 Jun 2016 00:44:14 +0000 (17:44 -0700)
committerStephen Boyd <sboyd@codeaurora.org>
Tue, 21 Jun 2016 00:44:14 +0000 (17:44 -0700)
* clk-fixes:
  clk: Fix return value check in oxnas_stdclk_probe()
  clk: rockchip: release io resource when failing to init clk on rk3399
  clk: rockchip: fix cpuclk registration error handling
  clk: rockchip: Revert "clk: rockchip: reset init state before mmc card initialization"
  clk: rockchip: fix incorrect parent for rk3399's {c,g}pll_aclk_perihp_src
  clk: rockchip: mark rk3399 GIC clocks as critical
  clk: rockchip: initialize flags of clk_init_data in mmc-phase clock

drivers/clk/clk-multiplier.c
drivers/clk/clk.c

index 9e449c7b751c328e23b074186e1bebf426172087..dc037c957acd8a1dc1f74f3c0407567a09fa66cd 100644 (file)
@@ -52,14 +52,28 @@ static unsigned long __bestmult(struct clk_hw *hw, unsigned long rate,
                                unsigned long *best_parent_rate,
                                u8 width, unsigned long flags)
 {
+       struct clk_multiplier *mult = to_clk_multiplier(hw);
        unsigned long orig_parent_rate = *best_parent_rate;
        unsigned long parent_rate, current_rate, best_rate = ~0;
        unsigned int i, bestmult = 0;
+       unsigned int maxmult = (1 << width) - 1;
+
+       if (!(clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT)) {
+               bestmult = rate / orig_parent_rate;
+
+               /* Make sure we don't end up with a 0 multiplier */
+               if ((bestmult == 0) &&
+                   !(mult->flags & CLK_MULTIPLIER_ZERO_BYPASS))
+                       bestmult = 1;
 
-       if (!(clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT))
-               return rate / *best_parent_rate;
+               /* Make sure we don't overflow the multiplier */
+               if (bestmult > maxmult)
+                       bestmult = maxmult;
+
+               return bestmult;
+       }
 
-       for (i = 1; i < ((1 << width) - 1); i++) {
+       for (i = 1; i < maxmult; i++) {
                if (rate == orig_parent_rate * i) {
                        /*
                         * This is the best case for us if we have a
index d584004f7af7d193d5f2646b482f26ce442deeef..874c7dd8ef66a39262f273f868ce36be7fd03373 100644 (file)
@@ -688,12 +688,12 @@ static void clk_core_disable(struct clk_core *core)
        if (--core->enable_count > 0)
                return;
 
-       trace_clk_disable(core);
+       trace_clk_disable_rcuidle(core);
 
        if (core->ops->disable)
                core->ops->disable(core->hw);
 
-       trace_clk_disable_complete(core);
+       trace_clk_disable_complete_rcuidle(core);
 
        clk_core_disable(core->parent);
 }
@@ -741,12 +741,12 @@ static int clk_core_enable(struct clk_core *core)
                if (ret)
                        return ret;
 
-               trace_clk_enable(core);
+               trace_clk_enable_rcuidle(core);
 
                if (core->ops->enable)
                        ret = core->ops->enable(core->hw);
 
-               trace_clk_enable_complete(core);
+               trace_clk_enable_complete_rcuidle(core);
 
                if (ret) {
                        clk_core_disable(core->parent);
This page took 0.028123 seconds and 5 git commands to generate.