Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 201571
b: refs/heads/master
c: 9b839ec
h: refs/heads/master
i:
  201569: 63b1da5
  201567: e75ce4a
v: v3
  • Loading branch information
Amit Kucheria authored and Sascha Hauer committed Jul 26, 2010
1 parent 77166d3 commit 5d9d24b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 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: c45dd814008f8842f854aa6960dfd6c610a01873
refs/heads/master: 9b839ec0a880977d05ec4d25028ca4a0c3216c61
37 changes: 25 additions & 12 deletions trunk/arch/arm/plat-mxc/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,28 @@ static void __clk_disable(struct clk *clk)
{
if (clk == NULL || IS_ERR(clk))
return;

__clk_disable(clk->parent);
__clk_disable(clk->secondary);

WARN_ON(!clk->usecount);
if (!(--clk->usecount) && clk->disable)
clk->disable(clk);

if (!(--clk->usecount)) {
if (clk->disable)
clk->disable(clk);
__clk_disable(clk->parent);
__clk_disable(clk->secondary);
}
}

static int __clk_enable(struct clk *clk)
{
if (clk == NULL || IS_ERR(clk))
return -EINVAL;

__clk_enable(clk->parent);
__clk_enable(clk->secondary);

if (clk->usecount++ == 0 && clk->enable)
clk->enable(clk);
if (clk->usecount++ == 0) {
__clk_enable(clk->parent);
__clk_enable(clk->secondary);

if (clk->enable)
clk->enable(clk);
}
return 0;
}

Expand Down Expand Up @@ -160,17 +162,28 @@ EXPORT_SYMBOL(clk_set_rate);
int clk_set_parent(struct clk *clk, struct clk *parent)
{
int ret = -EINVAL;
struct clk *old;

if (clk == NULL || IS_ERR(clk) || parent == NULL ||
IS_ERR(parent) || clk->set_parent == NULL)
return ret;

if (clk->usecount)
clk_enable(parent);

mutex_lock(&clocks_mutex);
ret = clk->set_parent(clk, parent);
if (ret == 0)
if (ret == 0) {
old = clk->parent;
clk->parent = parent;
} else {
old = parent;
}
mutex_unlock(&clocks_mutex);

if (clk->usecount)
clk_disable(old);

return ret;
}
EXPORT_SYMBOL(clk_set_parent);
Expand Down

0 comments on commit 5d9d24b

Please sign in to comment.