summaryrefslogtreecommitdiff
path: root/drivers/clk/clk-divider.c
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2012-04-12 16:50:17 +0400
committerMike Turquette <mturquette@linaro.org>2012-04-25 03:37:39 +0400
commit81536e072b54e30bbfd1a9a6b8094f7b3dd5321c (patch)
tree6c1f0df5e626ecf7c30368033478cdaf48b1b872 /drivers/clk/clk-divider.c
parent27d545915fd49cbe18a3877d82359896e9851efb (diff)
downloadlinux-81536e072b54e30bbfd1a9a6b8094f7b3dd5321c.tar.xz
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.c12
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,
if (divider->flags & CLK_DIVIDER_ONE_BASED)
maxdiv--;
- if (!best_parent_rate) {
- parent_rate = __clk_get_rate(__clk_get_parent(hw->clk));
+ if (!(__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT)) {
+ parent_rate = *best_parent_rate;
bestdiv = DIV_ROUND_UP(parent_rate, rate);
bestdiv = bestdiv == 0 ? 1 : bestdiv;
bestdiv = bestdiv > maxdiv ? maxdiv : bestdiv;
@@ -108,13 +108,7 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
int div;
div = clk_divider_bestdiv(hw, rate, prate);
- if (prate)
- return *prate / div;
- else {
- unsigned long r;
- r = __clk_get_rate(__clk_get_parent(hw->clk));
- return r / div;
- }
+ return *prate / div;
}
static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate)