[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201020092246.GE4077@smile.fi.intel.com>
Date: Tue, 20 Oct 2020 12:22:46 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Daniel Scally <djrscally@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
linux.walleij@...aro.org, prabhakar.mahadev-lad.rj@...renesas.com,
heikki.krogerus@...ux.intel.com, dmitry.torokhov@...il.com,
laurent.pinchart+renesas@...asonboard.com,
kieran.bingham+renesas@...asonboard.com, jacopo+renesas@...ndi.org,
robh@...nel.org, davem@...emloft.net, linux@...musvillemoes.dk,
sergey.senozhatsky@...il.com, rostedt@...dmis.org,
pmladek@...e.com, mchehab@...nel.org, tian.shu.qiu@...el.com,
bingbu.cao@...el.com, sakari.ailus@...ux.intel.com,
yong.zhi@...el.com, rafael@...nel.org, gregkh@...uxfoundation.org,
kitakar@...il.com, dan.carpenter@...cle.org
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@...ux.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
Powered by blists - more mailing lists