[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201218202916.GA4077@smile.fi.intel.com>
Date: Fri, 18 Dec 2020 22:29:16 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Daniel Scally <djrscally@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
linux-media@...r.kernel.org, devel@...ica.org, rjw@...ysocki.net,
lenb@...nel.org, gregkh@...uxfoundation.org, yong.zhi@...el.com,
sakari.ailus@...ux.intel.com, bingbu.cao@...el.com,
tian.shu.qiu@...el.com, mchehab@...nel.org, robert.moore@...el.com,
erik.kaneda@...el.com, pmladek@...e.com, rostedt@...dmis.org,
sergey.senozhatsky@...il.com, linux@...musvillemoes.dk,
laurent.pinchart+renesas@...asonboard.com,
jacopo+renesas@...ndi.org, kieran.bingham+renesas@...asonboard.com,
linus.walleij@...aro.org, heikki.krogerus@...ux.intel.com,
kitakar@...il.com, jorhand@...ux.microsoft.com
Subject: Re: [PATCH v2 04/12] software_node: Enforce parent before child
ordering of nodes arrays
On Thu, Dec 17, 2020 at 11:43:29PM +0000, Daniel Scally wrote:
> Registering software_nodes with the .parent member set to point to a
> currently unregistered software_node has the potential for problems,
> so enforce parent -> child ordering in arrays passed in to
> software_node_register_nodes().
>
> Software nodes that are children of another software node should be
> unregistered before their parent. To allow easy unregistering of an array
> of software_nodes ordered parent to child, reverse the order in which
> software_node_unregister_nodes() unregisters software_nodes.
...
> + * 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?
> + * 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.
> + 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** ?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists