diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2012-04-12 08:50:17 -0400 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2012-04-24 19:37:39 -0400 |
commit | 81536e072b54e30bbfd1a9a6b8094f7b3dd5321c (patch) | |
tree | 6c1f0df5e626ecf7c30368033478cdaf48b1b872 /drivers/clk/clk-divider.c | |
parent | 27d545915fd49cbe18a3877d82359896e9851efb (diff) |
clk: always pass parent_rate into .round_rate
The parent_rate will likely be used by most .round_rate implementation
no matter whether flag CLK_SET_RATE_PARENT is set or not, so let's
always pass parent_rate into .round_rate.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk/clk-divider.c')
-rw-r--r-- | drivers/clk/clk-divider.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 5fc541d017f1..03b127c0313b 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c | |||
@@ -67,8 +67,8 @@ static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate, | |||
67 | if (divider->flags & CLK_DIVIDER_ONE_BASED) | 67 | if (divider->flags & CLK_DIVIDER_ONE_BASED) |
68 | maxdiv--; | 68 | maxdiv--; |
69 | 69 | ||
70 | if (!best_parent_rate) { | 70 | if (!(__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT)) { |
71 | parent_rate = __clk_get_rate(__clk_get_parent(hw->clk)); | 71 | parent_rate = *best_parent_rate; |
72 | bestdiv = DIV_ROUND_UP(parent_rate, rate); | 72 | bestdiv = DIV_ROUND_UP(parent_rate, rate); |
73 | bestdiv = bestdiv == 0 ? 1 : bestdiv; | 73 | bestdiv = bestdiv == 0 ? 1 : bestdiv; |
74 | bestdiv = bestdiv > maxdiv ? maxdiv : bestdiv; | 74 | bestdiv = bestdiv > maxdiv ? maxdiv : bestdiv; |
@@ -108,13 +108,7 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate, | |||
108 | int div; | 108 | int div; |
109 | div = clk_divider_bestdiv(hw, rate, prate); | 109 | div = clk_divider_bestdiv(hw, rate, prate); |
110 | 110 | ||
111 | if (prate) | 111 | return *prate / div; |
112 | return *prate / div; | ||
113 | else { | ||
114 | unsigned long r; | ||
115 | r = __clk_get_rate(__clk_get_parent(hw->clk)); | ||
116 | return r / div; | ||
117 | } | ||
118 | } | 112 | } |
119 | 113 | ||
120 | static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate) | 114 | static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate) |