aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/of.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-10 16:53:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-10 16:53:52 -0400
commit31f7c3a688f75bceaf2fd009efc489659ad6aa61 (patch)
tree1721765e553c01559d1b784563d4840c5d3dd0b9 /include/linux/of.h
parentec5b103ecfde929004b691f29183255aeeadecd5 (diff)
parent2bc552df76d83cf1455ac8cf4c87615bfd15df74 (diff)
Merge tag 'devicetree-for-linus' of git://git.secretlab.ca/git/linux
Pull device tree core updates from Grant Likely: "Generally minor changes. A bunch of bug fixes, particularly for initialization and some refactoring. Most notable change if feeding the entire flattened tree into the random pool at boot. May not be significant, but shouldn't hurt either" Tim Bird questions whether the boot time cost of the random feeding may be noticeable. And "add_device_randomness()" is definitely not some speed deamon of a function. * tag 'devicetree-for-linus' of git://git.secretlab.ca/git/linux: of/platform: add error reporting to of_amba_device_create() irq/of: Fix comment typo for irq_of_parse_and_map of: Feed entire flattened device tree into the random pool of/fdt: Clean up casting in unflattening path of/fdt: Remove duplicate memory clearing on FDT unflattening gpio: implement gpio-ranges binding document fix of: call __of_parse_phandle_with_args from of_parse_phandle of: introduce of_parse_phandle_with_fixed_args of: move of_parse_phandle() of: move documentation of of_parse_phandle_with_args of: Fix missing memory initialization on FDT unflattening of: consolidate definition of early_init_dt_alloc_memory_arch() of: Make of_get_phy_mode() return int i.s.o. const int include: dt-binding: input: create a DT header defining key codes. of/platform: Staticize of_platform_device_create_pdata() of: Specify initrd location using 64-bit dt: Typo fix OF: make of_property_for_each_{u32|string}() use parameters if OF is not enabled
Diffstat (limited to 'include/linux/of.h')
-rw-r--r--include/linux/of.h49
1 files changed, 34 insertions, 15 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index 3a45c4f593ad..f95aee391e30 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -281,6 +281,9 @@ extern struct device_node *of_parse_phandle(const struct device_node *np,
281extern int of_parse_phandle_with_args(const struct device_node *np, 281extern int of_parse_phandle_with_args(const struct device_node *np,
282 const char *list_name, const char *cells_name, int index, 282 const char *list_name, const char *cells_name, int index,
283 struct of_phandle_args *out_args); 283 struct of_phandle_args *out_args);
284extern int of_parse_phandle_with_fixed_args(const struct device_node *np,
285 const char *list_name, int cells_count, int index,
286 struct of_phandle_args *out_args);
284extern int of_count_phandle_with_args(const struct device_node *np, 287extern int of_count_phandle_with_args(const struct device_node *np,
285 const char *list_name, const char *cells_name); 288 const char *list_name, const char *cells_name);
286 289
@@ -324,12 +327,6 @@ extern int of_detach_node(struct device_node *);
324 */ 327 */
325const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur, 328const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
326 u32 *pu); 329 u32 *pu);
327#define of_property_for_each_u32(np, propname, prop, p, u) \
328 for (prop = of_find_property(np, propname, NULL), \
329 p = of_prop_next_u32(prop, NULL, &u); \
330 p; \
331 p = of_prop_next_u32(prop, p, &u))
332
333/* 330/*
334 * struct property *prop; 331 * struct property *prop;
335 * const char *s; 332 * const char *s;
@@ -338,11 +335,6 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
338 * printk("String value: %s\n", s); 335 * printk("String value: %s\n", s);
339 */ 336 */
340const char *of_prop_next_string(struct property *prop, const char *cur); 337const char *of_prop_next_string(struct property *prop, const char *cur);
341#define of_property_for_each_string(np, propname, prop, s) \
342 for (prop = of_find_property(np, propname, NULL), \
343 s = of_prop_next_string(prop, NULL); \
344 s; \
345 s = of_prop_next_string(prop, s))
346 338
347int of_device_is_stdout_path(struct device_node *dn); 339int of_device_is_stdout_path(struct device_node *dn);
348 340
@@ -497,6 +489,13 @@ static inline int of_parse_phandle_with_args(struct device_node *np,
497 return -ENOSYS; 489 return -ENOSYS;
498} 490}
499 491
492static inline int of_parse_phandle_with_fixed_args(const struct device_node *np,
493 const char *list_name, int cells_count, int index,
494 struct of_phandle_args *out_args)
495{
496 return -ENOSYS;
497}
498
500static inline int of_count_phandle_with_args(struct device_node *np, 499static inline int of_count_phandle_with_args(struct device_node *np,
501 const char *list_name, 500 const char *list_name,
502 const char *cells_name) 501 const char *cells_name)
@@ -519,12 +518,20 @@ static inline int of_device_is_stdout_path(struct device_node *dn)
519 return 0; 518 return 0;
520} 519}
521 520
521static inline const __be32 *of_prop_next_u32(struct property *prop,
522 const __be32 *cur, u32 *pu)
523{
524 return NULL;
525}
526
527static inline const char *of_prop_next_string(struct property *prop,
528 const char *cur)
529{
530 return NULL;
531}
532
522#define of_match_ptr(_ptr) NULL 533#define of_match_ptr(_ptr) NULL
523#define of_match_node(_matches, _node) NULL 534#define of_match_node(_matches, _node) NULL
524#define of_property_for_each_u32(np, propname, prop, p, u) \
525 while (0)
526#define of_property_for_each_string(np, propname, prop, s) \
527 while (0)
528#endif /* CONFIG_OF */ 535#endif /* CONFIG_OF */
529 536
530#ifndef of_node_to_nid 537#ifndef of_node_to_nid
@@ -573,6 +580,18 @@ static inline int of_property_read_u32(const struct device_node *np,
573 return of_property_read_u32_array(np, propname, out_value, 1); 580 return of_property_read_u32_array(np, propname, out_value, 1);
574} 581}
575 582
583#define of_property_for_each_u32(np, propname, prop, p, u) \
584 for (prop = of_find_property(np, propname, NULL), \
585 p = of_prop_next_u32(prop, NULL, &u); \
586 p; \
587 p = of_prop_next_u32(prop, p, &u))
588
589#define of_property_for_each_string(np, propname, prop, s) \
590 for (prop = of_find_property(np, propname, NULL), \
591 s = of_prop_next_string(prop, NULL); \
592 s; \
593 s = of_prop_next_string(prop, s))
594
576#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE) 595#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE)
577extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); 596extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
578extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); 597extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);