Re: [PATCH v2 4/8] of: Add for_each_endpoint_of_node helper macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Philipp,

Thank you for the patch.

On Wednesday 10 September 2014 12:58:24 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.
> 
> Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>

Acked-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>

> ---
> Changes since v1:
>  - Added a comment about the child node reference count when breaking out
>    of the loop
> ---
>  include/linux/of_graph.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h
> index befef42..e43442e 100644
> --- a/include/linux/of_graph.h
> +++ b/include/linux/of_graph.h
> @@ -26,6 +26,17 @@ struct of_endpoint {
>  	const struct device_node *local_node;
>  };
> 
> +/**
> + * for_each_endpoint_of_node - iterate over every endpoint in a device node
> + * @parent: parent device node containing ports and endpoints
> + * @child: loop variable pointing to the current endpoint node
> + *
> + * When breaking out of the loop, of_node_put(child) has to be called
> manually. + */
> +#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

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux