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

From: Stephen Boyd
Date: Fri Feb 15 2019 - 13:47:16 EST


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.