lkml.org 
[lkml]   [2014]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 4/8] of: Add for_each_endpoint_of_node helper macro
Date
Hi Philipp,

Thank you for the patch.

On Tuesday 19 August 2014 15:02:42 Philipp Zabel wrote:
> Note that while of_graph_get_next_endpoint decrements the reference count
> of the child node passed to it, of_node_put(child) still has to be called
> manually when breaking out of the loop.

I think this is important enough to be mentioned in a comment in of_graph.h.

> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
> include/linux/of_graph.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h
> index befef42..2890a4c 100644
> --- a/include/linux/of_graph.h
> +++ b/include/linux/of_graph.h
> @@ -26,6 +26,10 @@ struct of_endpoint {
> const struct device_node *local_node;
> };
>
> +#define for_each_endpoint_of_node(parent, child) \
> + for (child = of_graph_get_next_endpoint(parent, NULL); child != NULL; \
> + child = of_graph_get_next_endpoint(parent, child))
> +
> #ifdef CONFIG_OF
> int of_graph_parse_endpoint(const struct device_node *node,
> struct of_endpoint *endpoint);

--
Regards,

Laurent Pinchart




\
 
 \ /
  Last update: 2014-08-20 22:21    [W:0.063 / U:0.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site