lkml.org 
[lkml]   [2013]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCHv5 1/9] of: introduce of_property_for_earch_phandle_with_args()
Date
On Tue, 19 Nov 2013 11:33:05 +0200, Hiroshi Doyu <hdoyu@nvidia.com> wrote:
> The following pattern of code is tempting:
>
> for (i = 0; !of_parse_phandle_with_args(np, list, cells, i, args); i++)
>
> Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com>

That's a very minimal commit message. Can you elaborate please.

> ---
> v5:
> New patch for v5.
> ---
> include/linux/of.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 276c546..131fef5 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -613,6 +613,9 @@ static inline int of_property_read_u32(const struct device_node *np,
> s; \
> s = of_prop_next_string(prop, s))
>
> +#define of_property_for_each_phandle_with_args(np, list, cells, i, args) \
> + for (i = 0; !of_parse_phandle_with_args(np, list, cells, i, args); i++)
> +

That works, but pretty darn inefficient. We need an iterator version of
of_parse_phandle_with_args() to loop over all the entries.

> #if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE)
> extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
> extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);
> --
> 1.8.1.5
>



\
 
 \ /
  Last update: 2013-11-21 14:21    [W:0.245 / U:0.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site