aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk.c
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2012-04-12 08:50:17 -0400
committerMike Turquette <mturquette@linaro.org>2012-04-24 19:37:39 -0400
commit81536e072b54e30bbfd1a9a6b8094f7b3dd5321c (patch)
tree6c1f0df5e626ecf7c30368033478cdaf48b1b872 /drivers/clk/clk.c
parent27d545915fd49cbe18a3877d82359896e9851efb (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.c')
-rw-r--r--drivers/clk/clk.c16
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);
582 */ 582 */
583unsigned long __clk_round_rate(struct clk *clk, unsigned long rate) 583unsigned long __clk_round_rate(struct clk *clk, unsigned long rate)
584{ 584{
585 unsigned long unused; 585 unsigned long parent_rate = 0;
586 586
587 if (!clk) 587 if (!clk)
588 return -EINVAL; 588 return -EINVAL;
@@ -590,10 +590,10 @@ unsigned long __clk_round_rate(struct clk *clk, unsigned long rate)
590 if (!clk->ops->round_rate) 590 if (!clk->ops->round_rate)
591 return clk->rate; 591 return clk->rate;
592 592
593 if (clk->flags & CLK_SET_RATE_PARENT) 593 if (clk->parent)
594 return clk->ops->round_rate(clk->hw, rate, &unused); 594 parent_rate = clk->parent->rate;
595 else 595
596 return clk->ops->round_rate(clk->hw, rate, NULL); 596 return clk->ops->round_rate(clk->hw, rate, &parent_rate);
597} 597}
598 598
599/** 599/**
@@ -763,7 +763,7 @@ static void clk_calc_subtree(struct clk *clk, unsigned long new_rate)
763static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate) 763static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate)
764{ 764{
765 struct clk *top = clk; 765 struct clk *top = clk;
766 unsigned long best_parent_rate; 766 unsigned long best_parent_rate = 0;
767 unsigned long new_rate; 767 unsigned long new_rate;
768 768
769 /* sanity */ 769 /* sanity */
@@ -775,9 +775,6 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate)
775 if (!clk->ops->round_rate) { 775 if (!clk->ops->round_rate) {
776 clk->new_rate = clk->rate; 776 clk->new_rate = clk->rate;
777 return NULL; 777 return NULL;
778 } else {
779 new_rate = clk->ops->round_rate(clk->hw, rate, NULL);
780 goto out;
781 } 778 }
782 } 779 }
783 780
@@ -794,6 +791,7 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate)
794 goto out; 791 goto out;
795 } 792 }
796 793
794 best_parent_rate = clk->parent->rate;
797 new_rate = clk->ops->round_rate(clk->hw, rate, &best_parent_rate); 795 new_rate = clk->ops->round_rate(clk->hw, rate, &best_parent_rate);
798 796
799 if (best_parent_rate != clk->parent->rate) { 797 if (best_parent_rate != clk->parent->rate) {