Re: [PATCH v2 04/12] software_node: Enforce parent before child ordering of nodes arrays

From: Daniel Scally
Date: Sat Dec 19 2020 - 18:33:55 EST


On 18/12/2020 20:29, Andy Shevchenko wrote:
>> + * Register multiple software nodes at once. If any node in the array
>> + * has it's .parent pointer set, then it's parent **must** have been
>
> it's => its in both cases?

Done, ty

>> + * registered before it is; either outside of this function or by
>> + * ordering the array such that parent comes before child.
>> */
>
> ...
>
>> + const struct software_node *parent = nodes[i].parent;
>> +
>> + if (parent && !software_node_to_swnode(parent)) {
>
> Can we have parent of swnode in an array not being an swnode?
> Either comment that parent for swnode can be swnode only (Heikki, was it an
> idea?) or check if parent is of swnode type and only that apply this
> requirement.

.parent can be a pointer to software_node only yes; I can add that to
the document comment.

>> + ret = -EINVAL;
>> + goto err_unregister_nodes;
>> }
>
> ...
>
>> + * Unregister multiple software nodes at once. If parent pointers are set up
>> + * in any of the software nodes then the array MUST be ordered such that
>> + * parents come before their children.
>
> Shouldn't be consistent with above, i.e. **must** ?

Done also