Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308202
b: refs/heads/master
c: 81536e0
h: refs/heads/master
v: v3
  • Loading branch information
Shawn Guo authored and Mike Turquette committed Apr 24, 2012
1 parent 7171993 commit 7a09b84
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 27d545915fd49cbe18a3877d82359896e9851efb
refs/heads/master: 81536e072b54e30bbfd1a9a6b8094f7b3dd5321c
12 changes: 3 additions & 9 deletions trunk/drivers/clk/clk-divider.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
16 changes: 7 additions & 9 deletions trunk/drivers/clk/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,18 +582,18 @@ 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;

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);
}

/**
Expand Down Expand Up @@ -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 */
Expand All @@ -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;
}
}

Expand All @@ -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) {
Expand Down

0 comments on commit 7a09b84

Please sign in to comment.