diff options
Diffstat (limited to 'include/linux/of.h')
-rw-r--r-- | include/linux/of.h | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index f95aee391e30..276c546980d8 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -136,7 +136,9 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size) | |||
136 | return of_read_number(cell, size); | 136 | return of_read_number(cell, size); |
137 | } | 137 | } |
138 | 138 | ||
139 | #if defined(CONFIG_SPARC) | ||
139 | #include <asm/prom.h> | 140 | #include <asm/prom.h> |
141 | #endif | ||
140 | 142 | ||
141 | /* Default #address and #size cells. Allow arch asm/prom.h to override */ | 143 | /* Default #address and #size cells. Allow arch asm/prom.h to override */ |
142 | #if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT) | 144 | #if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT) |
@@ -226,6 +228,19 @@ static inline int of_get_child_count(const struct device_node *np) | |||
226 | return num; | 228 | return num; |
227 | } | 229 | } |
228 | 230 | ||
231 | static inline int of_get_available_child_count(const struct device_node *np) | ||
232 | { | ||
233 | struct device_node *child; | ||
234 | int num = 0; | ||
235 | |||
236 | for_each_available_child_of_node(np, child) | ||
237 | num++; | ||
238 | |||
239 | return num; | ||
240 | } | ||
241 | |||
242 | /* cache lookup */ | ||
243 | extern struct device_node *of_find_next_cache_node(const struct device_node *); | ||
229 | extern struct device_node *of_find_node_with_property( | 244 | extern struct device_node *of_find_node_with_property( |
230 | struct device_node *from, const char *prop_name); | 245 | struct device_node *from, const char *prop_name); |
231 | #define for_each_node_with_property(dn, prop_name) \ | 246 | #define for_each_node_with_property(dn, prop_name) \ |
@@ -275,6 +290,7 @@ extern int of_n_size_cells(struct device_node *np); | |||
275 | extern const struct of_device_id *of_match_node( | 290 | extern const struct of_device_id *of_match_node( |
276 | const struct of_device_id *matches, const struct device_node *node); | 291 | const struct of_device_id *matches, const struct device_node *node); |
277 | extern int of_modalias_node(struct device_node *node, char *modalias, int len); | 292 | extern int of_modalias_node(struct device_node *node, char *modalias, int len); |
293 | extern void of_print_phandle_args(const char *msg, const struct of_phandle_args *args); | ||
278 | extern struct device_node *of_parse_phandle(const struct device_node *np, | 294 | extern struct device_node *of_parse_phandle(const struct device_node *np, |
279 | const char *phandle_name, | 295 | const char *phandle_name, |
280 | int index); | 296 | int index); |
@@ -364,6 +380,9 @@ static inline bool of_have_populated_dt(void) | |||
364 | #define for_each_child_of_node(parent, child) \ | 380 | #define for_each_child_of_node(parent, child) \ |
365 | while (0) | 381 | while (0) |
366 | 382 | ||
383 | #define for_each_available_child_of_node(parent, child) \ | ||
384 | while (0) | ||
385 | |||
367 | static inline struct device_node *of_get_child_by_name( | 386 | static inline struct device_node *of_get_child_by_name( |
368 | const struct device_node *node, | 387 | const struct device_node *node, |
369 | const char *name) | 388 | const char *name) |
@@ -376,6 +395,11 @@ static inline int of_get_child_count(const struct device_node *np) | |||
376 | return 0; | 395 | return 0; |
377 | } | 396 | } |
378 | 397 | ||
398 | static inline int of_get_available_child_count(const struct device_node *np) | ||
399 | { | ||
400 | return 0; | ||
401 | } | ||
402 | |||
379 | static inline int of_device_is_compatible(const struct device_node *device, | 403 | static inline int of_device_is_compatible(const struct device_node *device, |
380 | const char *name) | 404 | const char *name) |
381 | { | 405 | { |
@@ -534,13 +558,10 @@ static inline const char *of_prop_next_string(struct property *prop, | |||
534 | #define of_match_node(_matches, _node) NULL | 558 | #define of_match_node(_matches, _node) NULL |
535 | #endif /* CONFIG_OF */ | 559 | #endif /* CONFIG_OF */ |
536 | 560 | ||
537 | #ifndef of_node_to_nid | 561 | #if defined(CONFIG_OF) && defined(CONFIG_NUMA) |
538 | static inline int of_node_to_nid(struct device_node *np) | 562 | extern int of_node_to_nid(struct device_node *np); |
539 | { | 563 | #else |
540 | return numa_node_id(); | 564 | static inline int of_node_to_nid(struct device_node *device) { return 0; } |
541 | } | ||
542 | |||
543 | #define of_node_to_nid of_node_to_nid | ||
544 | #endif | 565 | #endif |
545 | 566 | ||
546 | /** | 567 | /** |