summaryrefslogtreecommitdiffstats
path: root/include/linux/of.h
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2016-04-04 11:49:17 -0400
committerRob Herring <robh@kernel.org>2016-04-19 18:25:13 -0400
commit74e1fbb1375a3ede3e17da22911761ce9bc8f53f (patch)
treec8266f60cd6920751d20c5d8d136e4be57bab2b7 /include/linux/of.h
parent34b82026a507ec0092398d9fc7893c00dd11b7da (diff)
of: Introduce struct of_phandle_iterator
This struct carrys all necessary information to iterate over a list of phandles and extract the arguments. Add an init-function for the iterator and make use of it in __of_parse_phandle_with_args(). Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'include/linux/of.h')
-rw-r--r--include/linux/of.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index 7fcb681baadf..0f187dbb890b 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -75,6 +75,23 @@ struct of_phandle_args {
75 uint32_t args[MAX_PHANDLE_ARGS]; 75 uint32_t args[MAX_PHANDLE_ARGS];
76}; 76};
77 77
78struct of_phandle_iterator {
79 /* Common iterator information */
80 const char *cells_name;
81 int cell_count;
82 const struct device_node *parent;
83
84 /* List size information */
85 const __be32 *list_end;
86 const __be32 *phandle_end;
87
88 /* Current position state */
89 const __be32 *cur;
90 uint32_t cur_count;
91 phandle phandle;
92 struct device_node *node;
93};
94
78struct of_reconfig_data { 95struct of_reconfig_data {
79 struct device_node *dn; 96 struct device_node *dn;
80 struct property *prop; 97 struct property *prop;
@@ -334,6 +351,13 @@ extern int of_parse_phandle_with_fixed_args(const struct device_node *np,
334extern int of_count_phandle_with_args(const struct device_node *np, 351extern int of_count_phandle_with_args(const struct device_node *np,
335 const char *list_name, const char *cells_name); 352 const char *list_name, const char *cells_name);
336 353
354/* phandle iterator functions */
355extern int of_phandle_iterator_init(struct of_phandle_iterator *it,
356 const struct device_node *np,
357 const char *list_name,
358 const char *cells_name,
359 int cell_count);
360
337extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); 361extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
338extern int of_alias_get_id(struct device_node *np, const char *stem); 362extern int of_alias_get_id(struct device_node *np, const char *stem);
339extern int of_alias_get_highest_id(const char *stem); 363extern int of_alias_get_highest_id(const char *stem);
@@ -608,6 +632,15 @@ static inline int of_count_phandle_with_args(struct device_node *np,
608 return -ENOSYS; 632 return -ENOSYS;
609} 633}
610 634
635static inline int of_phandle_iterator_init(struct of_phandle_iterator *it,
636 const struct device_node *np,
637 const char *list_name,
638 const char *cells_name,
639 int cell_count)
640{
641 return -ENOSYS;
642}
643
611static inline int of_alias_get_id(struct device_node *np, const char *stem) 644static inline int of_alias_get_id(struct device_node *np, const char *stem)
612{ 645{
613 return -ENOSYS; 646 return -ENOSYS;