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@xxxxxxxxxxxxxxx> 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