diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2011-08-15 03:28:14 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-09-22 13:12:10 -0400 |
commit | 611cad720148c899db5a383c1c676fd820df7023 (patch) | |
tree | 780adeaa4418b7b1e76d4a3b8fe600f04475c7df /include | |
parent | a81dd364de50bc1eb1519af0ecfa100753a09351 (diff) |
dt: add of_alias_scan and of_alias_get_id
The patch adds function of_alias_scan to populate a global lookup
table with the properties of 'aliases' node and function
of_alias_get_id for drivers to find alias id from the lookup table.
v3: Split out automatic addition of aliases on id lookup so that it can be
debated separately from the core functionality.
v2: - Add of_chosen/of_aliases populating and of_alias_scan() invocation
for OF_PROMTREE.
- Add locking
- rework parse loop
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/of.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index 9180dc5cb00b..8b6383d876ca 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -68,6 +68,7 @@ struct device_node { | |||
68 | /* Pointer for first entry in chain of all nodes. */ | 68 | /* Pointer for first entry in chain of all nodes. */ |
69 | extern struct device_node *allnodes; | 69 | extern struct device_node *allnodes; |
70 | extern struct device_node *of_chosen; | 70 | extern struct device_node *of_chosen; |
71 | extern struct device_node *of_aliases; | ||
71 | extern rwlock_t devtree_lock; | 72 | extern rwlock_t devtree_lock; |
72 | 73 | ||
73 | static inline bool of_have_populated_dt(void) | 74 | static inline bool of_have_populated_dt(void) |
@@ -209,6 +210,9 @@ extern int of_device_is_available(const struct device_node *device); | |||
209 | extern const void *of_get_property(const struct device_node *node, | 210 | extern const void *of_get_property(const struct device_node *node, |
210 | const char *name, | 211 | const char *name, |
211 | int *lenp); | 212 | int *lenp); |
213 | #define for_each_property(pp, properties) \ | ||
214 | for (pp = properties; pp != NULL; pp = pp->next) | ||
215 | |||
212 | extern int of_n_addr_cells(struct device_node *np); | 216 | extern int of_n_addr_cells(struct device_node *np); |
213 | extern int of_n_size_cells(struct device_node *np); | 217 | extern int of_n_size_cells(struct device_node *np); |
214 | extern const struct of_device_id *of_match_node( | 218 | extern const struct of_device_id *of_match_node( |
@@ -221,6 +225,9 @@ extern int of_parse_phandles_with_args(struct device_node *np, | |||
221 | const char *list_name, const char *cells_name, int index, | 225 | const char *list_name, const char *cells_name, int index, |
222 | struct device_node **out_node, const void **out_args); | 226 | struct device_node **out_node, const void **out_args); |
223 | 227 | ||
228 | extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); | ||
229 | extern int of_alias_get_id(struct device_node *np, const char *stem); | ||
230 | |||
224 | extern int of_machine_is_compatible(const char *compat); | 231 | extern int of_machine_is_compatible(const char *compat); |
225 | 232 | ||
226 | extern int prom_add_property(struct device_node* np, struct property* prop); | 233 | extern int prom_add_property(struct device_node* np, struct property* prop); |