Messages in this thread | | | Date | Tue, 20 Oct 2020 12:22:46 +0300 | From | Andy Shevchenko <> | Subject | Re: [RFC PATCH v3 1/9] software_node: Add helper function to unregister arrays of software_nodes ordered parent to child |
| |
On Mon, Oct 19, 2020 at 11:58:55PM +0100, Daniel Scally wrote: > 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, add a helper function to loop > over and unregister nodes in such an array in reverse order.
> Suggested-by: Andriy Shevchenko <andriy.shevchenko@linux.intel.com>
For all patches Andriy -> Andy (email stays as above!).
...
> +/** > + * software_node_unregister_nodes_reverse - Unregister an array of software > + * nodes in reverse order.
Can you shrink this to one line?
Something like dropping ' in reverse order.' and adding it below...
> + * @nodes: Array of software nodes to be unregistered. > + *
...like here to explain reversed order?
> + * NOTE: The same warning applies as with software_node_unregister_nodes.
software_node_unregister_nodes()
> + * Unless you are _sure_ that the array of nodes is ordered parent to child > + * it is wiser to remove them individually in the correct order. > + */ > +void software_node_unregister_nodes_reverse(const struct software_node *nodes) > +{ > + unsigned int i = 0; > + > + while (nodes[i].name) > + i++; > + > + while (i--) > + software_node_unregister(&nodes[i]); > +}
-- With Best Regards, Andy Shevchenko
| |