@@ -2360,8 +2360,8 @@ static int __clk_init(struct device *dev
* for a NULL pointer. We can always perform lazy lookups for
* missing parents later on.
*/
- if (core->parents)
- for (i = 0; i < core->num_parents; i++)
+ for (i = 0; i < core->num_parents; i++)
+ if (core->parents && !core->parents[i])
core->parents[i] =
clk_core_lookup(core->parent_names[i]);
}
@@ -2549,7 +2549,9 @@ struct clk *clk_register(struct device *
ret = -ENOMEM;
goto fail_parent_names;
}
-
+ if (hw->init->parents)
+ core->parents = kcalloc(core->num_parents, sizeof(struct clk *),
+ GFP_KERNEL);
/* copy each string name in case parent_names is __initdata */
for (i = 0; i < core->num_parents; i++) {
@@ -2561,6 +2563,11 @@ struct clk *clk_register(struct device *
}
}
+ /* convert each parent pointer to struct clk_core */
+ for (i = 0; i < core->num_parents; i++)
+ if (core->parents && !IS_ERR(hw->init->parents[i]))
+ core->parents[i] = hw->init->parents[i]->core;
+
INIT_HLIST_HEAD(&core->clks);
hw->clk = __clk_create_clk(hw, NULL, NULL);
@@ -2577,6 +2584,7 @@ struct clk *clk_register(struct device *
hw->clk = NULL;
fail_parent_names_copy:
+ kfree(core->parents);
while (--i >= 0)
kfree_const(core->parent_names[i]);
kfree(core->parent_names);
@@ -222,6 +222,7 @@ struct clk_ops {
* @name: clock name
* @ops: operations this clock supports
* @parent_names: array of string names for all possible parents
+ * @parents: array of pointers to all possible parents
* @num_parents: number of possible parents
* @flags: framework-level hints and quirks
*/
@@ -229,6 +230,7 @@ struct clk_init_data {
const char *name;
const struct clk_ops *ops;
const char * const *parent_names;
+ struct clk **parents;
u8 num_parents;
unsigned long flags;
};