diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-07-10 16:05:56 +0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-07-12 19:35:42 +0400 |
commit | 14d597b74aed3c44af0ee8f5ea24b970a50aec99 (patch) | |
tree | 7cd25aa0621ccc82dd2b613656e74aacdf4afdde /drivers/clk | |
parent | 8caec0d048609ccf8c75025b0d73af10f74e2157 (diff) | |
parent | bd0a521e88aa7a06ae7aabaed7ae196ed4ad867a (diff) | |
download | linux-14d597b74aed3c44af0ee8f5ea24b970a50aec99.tar.xz |
Merge tag 'v3.5-rc6' into next/dt
New pull requests are based on Linux 3.5-rc6
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/clk.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index dcbe05616090..9a1eb0cfa95f 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1067,26 +1067,24 @@ static int __clk_set_parent(struct clk *clk, struct clk *parent) old_parent = clk->parent; - /* find index of new parent clock using cached parent ptrs */ - if (clk->parents) - for (i = 0; i < clk->num_parents; i++) - if (clk->parents[i] == parent) - break; - else + if (!clk->parents) clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents), GFP_KERNEL); /* - * find index of new parent clock using string name comparison - * also try to cache the parent to avoid future calls to __clk_lookup + * find index of new parent clock using cached parent ptrs, + * or if not yet cached, use string name comparison and cache + * them now to avoid future calls to __clk_lookup. */ - if (i == clk->num_parents) - for (i = 0; i < clk->num_parents; i++) - if (!strcmp(clk->parent_names[i], parent->name)) { - if (clk->parents) - clk->parents[i] = __clk_lookup(parent->name); - break; - } + for (i = 0; i < clk->num_parents; i++) { + if (clk->parents && clk->parents[i] == parent) + break; + else if (!strcmp(clk->parent_names[i], parent->name)) { + if (clk->parents) + clk->parents[i] = __clk_lookup(parent->name); + break; + } + } if (i == clk->num_parents) { pr_debug("%s: clock %s is not a possible parent of clock %s\n", |