diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2012-04-12 20:50:17 +0800 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2012-04-24 16:37:39 -0700 |
commit | 81536e072b54e30bbfd1a9a6b8094f7b3dd5321c (patch) | |
tree | 6c1f0df5e626ecf7c30368033478cdaf48b1b872 /drivers/clk/clk.c | |
parent | 27d545915fd49cbe18a3877d82359896e9851efb (diff) | |
download | blackbird-op-linux-81536e072b54e30bbfd1a9a6b8094f7b3dd5321c.tar.gz blackbird-op-linux-81536e072b54e30bbfd1a9a6b8094f7b3dd5321c.zip |
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.c')
-rw-r--r-- | drivers/clk/clk.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 8f7c3849c8f6..1ab4f7e5c7ef 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -582,7 +582,7 @@ EXPORT_SYMBOL_GPL(clk_get_rate); */ unsigned long __clk_round_rate(struct clk *clk, unsigned long rate) { - unsigned long unused; + unsigned long parent_rate = 0; if (!clk) return -EINVAL; @@ -590,10 +590,10 @@ unsigned long __clk_round_rate(struct clk *clk, unsigned long rate) if (!clk->ops->round_rate) return clk->rate; - if (clk->flags & CLK_SET_RATE_PARENT) - return clk->ops->round_rate(clk->hw, rate, &unused); - else - return clk->ops->round_rate(clk->hw, rate, NULL); + if (clk->parent) + parent_rate = clk->parent->rate; + + return clk->ops->round_rate(clk->hw, rate, &parent_rate); } /** @@ -763,7 +763,7 @@ static void clk_calc_subtree(struct clk *clk, unsigned long new_rate) static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate) { struct clk *top = clk; - unsigned long best_parent_rate; + unsigned long best_parent_rate = 0; unsigned long new_rate; /* sanity */ @@ -775,9 +775,6 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate) if (!clk->ops->round_rate) { clk->new_rate = clk->rate; return NULL; - } else { - new_rate = clk->ops->round_rate(clk->hw, rate, NULL); - goto out; } } @@ -794,6 +791,7 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate) goto out; } + best_parent_rate = clk->parent->rate; new_rate = clk->ops->round_rate(clk->hw, rate, &best_parent_rate); if (best_parent_rate != clk->parent->rate) { |