Re: [PATCH 2/9] clk: Introduce get_parent_hw clk op

From: Jeffrey Hugo
Date: Fri Feb 15 2019 - 16:34:55 EST


On 2/15/2019 2:29 PM, Stephen Boyd wrote:
Quoting Jeffrey Hugo (2019-02-15 11:29:26)
On 2/15/2019 11:47 AM, Stephen Boyd wrote:
Quoting Jeffrey Hugo (2019-02-11 08:09:00)
On 1/28/2019 11:10 PM, Stephen Boyd wrote:

+static int clk_init_parent(struct clk_core *core)
+{
+ core->parent = __clk_init_parent(core, true);
+ if (IS_ERR(core->parent))
+ return PTR_ERR(core->parent);
+
+ /*
+ * Populate core->parent if parent has already been clk_core_init'd. If
+ * parent has not yet been clk_core_init'd then place clk in the orphan
+ * list. If clk doesn't have any parents then place it in the root
+ * clk list.
+ *
+ * Every time a new clk is clk_init'd then we walk the list of orphan
+ * clocks and re-parent any that are children of the clock currently
+ * being clk_init'd.
+ */
+ if (core->parent) {
+ hlist_add_head(&core->child_node,
+ &core->parent->children);
+ core->orphan = core->parent->orphan;
+ } else if (!core->num_parents) {
+ hlist_add_head(&core->child_node, &clk_root_list);
+ core->orphan = false;
+ } else {
+ hlist_add_head(&core->child_node, &clk_orphan_list);

Missing "core->orphan = true;"?
The snippet below had that line. Its not clear why it appears to be
dropped here.


Hmm. Weird. I think I may have been getting ahead of myself and moving
the orphan updating code into __clk_init_parent(). I can't remember why
though, so I guess I'll go all the way and move it all into
__clk_init_parent() now. Thanks for pointing it out.


No problem.

Just FYI, I've rebased the 8998 mmcc series on top of this, and as far
as I can tell, everything seems to be working great.


Cool. Are you using the new way to specify parents or have you
maintained the previous design of using string names for parents?


I fully converted to the new way, although I did it in stages, so both paths got tested during the conversion. I plan on posting v2 next week.

--
Jeffrey Hugo
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.