diff options
Diffstat (limited to 'drivers/clk/clk.c')
-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) | |||
1067 | 1067 | ||
1068 | old_parent = clk->parent; | 1068 | old_parent = clk->parent; |
1069 | 1069 | ||
1070 | /* find index of new parent clock using cached parent ptrs */ | 1070 | if (!clk->parents) |
1071 | if (clk->parents) | ||
1072 | for (i = 0; i < clk->num_parents; i++) | ||
1073 | if (clk->parents[i] == parent) | ||
1074 | break; | ||
1075 | else | ||
1076 | clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents), | 1071 | clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents), |
1077 | GFP_KERNEL); | 1072 | GFP_KERNEL); |
1078 | 1073 | ||
1079 | /* | 1074 | /* |
1080 | * find index of new parent clock using string name comparison | 1075 | * find index of new parent clock using cached parent ptrs, |
1081 | * also try to cache the parent to avoid future calls to __clk_lookup | 1076 | * or if not yet cached, use string name comparison and cache |
1077 | * them now to avoid future calls to __clk_lookup. | ||
1082 | */ | 1078 | */ |
1083 | if (i == clk->num_parents) | 1079 | for (i = 0; i < clk->num_parents; i++) { |
1084 | for (i = 0; i < clk->num_parents; i++) | 1080 | if (clk->parents && clk->parents[i] == parent) |
1085 | if (!strcmp(clk->parent_names[i], parent->name)) { | 1081 | break; |
1086 | if (clk->parents) | 1082 | else if (!strcmp(clk->parent_names[i], parent->name)) { |
1087 | clk->parents[i] = __clk_lookup(parent->name); | 1083 | if (clk->parents) |
1088 | break; | 1084 | clk->parents[i] = __clk_lookup(parent->name); |
1089 | } | 1085 | break; |
1086 | } | ||
1087 | } | ||
1090 | 1088 | ||
1091 | if (i == clk->num_parents) { | 1089 | if (i == clk->num_parents) { |
1092 | pr_debug("%s: clock %s is not a possible parent of clock %s\n", | 1090 | pr_debug("%s: clock %s is not a possible parent of clock %s\n", |