lkml.org 
[lkml]   [2020]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2020-10-20 11:22    [W:0.407 / U:0.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site