clk: Check for failure at clk_change_rate
The clock rate set could fail, thus check for failure and abort clock rate change in case the clk_set_rate fails. Change-Id: I3a3a03f8c0c261b1f89c33e1247e3dbf889a8d26 Signed-off-by: Taniya Das <tdas@codeaurora.org>
This commit is contained in:
parent
fd45ca9c59
commit
1267aad12d
1 changed files with 22 additions and 4 deletions
|
@ -1449,7 +1449,7 @@ static struct clk_core *clk_propagate_rate_change(struct clk_core *core,
|
|||
* walk down a subtree and set the new rates notifying the rate
|
||||
* change on the way
|
||||
*/
|
||||
static void clk_change_rate(struct clk_core *core)
|
||||
static int clk_change_rate(struct clk_core *core)
|
||||
{
|
||||
struct clk_core *child;
|
||||
struct hlist_node *tmp;
|
||||
|
@ -1457,6 +1457,7 @@ static void clk_change_rate(struct clk_core *core)
|
|||
unsigned long best_parent_rate = 0;
|
||||
bool skip_set_rate = false;
|
||||
struct clk_core *old_parent;
|
||||
int rc = 0;
|
||||
|
||||
old_rate = core->rate;
|
||||
|
||||
|
@ -1484,8 +1485,12 @@ static void clk_change_rate(struct clk_core *core)
|
|||
|
||||
trace_clk_set_rate(core, core->new_rate);
|
||||
|
||||
if (!skip_set_rate && core->ops->set_rate)
|
||||
core->ops->set_rate(core->hw, core->new_rate, best_parent_rate);
|
||||
if (!skip_set_rate && core->ops->set_rate) {
|
||||
rc = core->ops->set_rate(core->hw, core->new_rate,
|
||||
best_parent_rate);
|
||||
if (rc)
|
||||
goto out;
|
||||
}
|
||||
|
||||
trace_clk_set_rate_complete(core, core->new_rate);
|
||||
|
||||
|
@ -1511,6 +1516,13 @@ static void clk_change_rate(struct clk_core *core)
|
|||
/* handle the new child who might not be in core->children yet */
|
||||
if (core->new_child)
|
||||
clk_change_rate(core->new_child);
|
||||
|
||||
return rc;
|
||||
|
||||
out:
|
||||
trace_clk_set_rate_complete(core, core->new_rate);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int clk_core_set_rate_nolock(struct clk_core *core,
|
||||
|
@ -1545,7 +1557,13 @@ static int clk_core_set_rate_nolock(struct clk_core *core,
|
|||
}
|
||||
|
||||
/* change the rates */
|
||||
clk_change_rate(top);
|
||||
ret = clk_change_rate(top);
|
||||
if (ret) {
|
||||
pr_err("%s: failed to set %s rate\n", __func__,
|
||||
top->name);
|
||||
clk_propagate_rate_change(top, ABORT_RATE_CHANGE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
core->req_rate = req_rate;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue