aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2013-06-17 10:48:13 -0400
committerGrant Likely <grant.likely@linaro.org>2013-07-24 06:09:59 -0400
commit2adfffa223500b739b17dcf3d710cec344f7608f (patch)
tree37ffed6b619b904dcc6796bacfeb4f0a574abbaa /include
parent3b2f64d00c46e1e4e9bd0bb9bb12619adac27a4b (diff)
OF: make of_property_for_each_{u32|string}() use parameters if OF is not enabled
I am getting a few |warning: unused variable ‘p’ [-Wunused-variable] |warning: unused variable ‘prop’ [-Wunused-variable] in the case where CONFIG_OF is not defined and the parameters are only used in the loop macro. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/of.h39
1 files changed, 24 insertions, 15 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index 1fd08ca23106..90a8811e9e48 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -323,12 +323,6 @@ extern int of_detach_node(struct device_node *);
323 */ 323 */
324const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur, 324const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
325 u32 *pu); 325 u32 *pu);
326#define of_property_for_each_u32(np, propname, prop, p, u) \
327 for (prop = of_find_property(np, propname, NULL), \
328 p = of_prop_next_u32(prop, NULL, &u); \
329 p; \
330 p = of_prop_next_u32(prop, p, &u))
331
332/* 326/*
333 * struct property *prop; 327 * struct property *prop;
334 * const char *s; 328 * const char *s;
@@ -337,11 +331,6 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
337 * printk("String value: %s\n", s); 331 * printk("String value: %s\n", s);
338 */ 332 */
339const char *of_prop_next_string(struct property *prop, const char *cur); 333const char *of_prop_next_string(struct property *prop, const char *cur);
340#define of_property_for_each_string(np, propname, prop, s) \
341 for (prop = of_find_property(np, propname, NULL), \
342 s = of_prop_next_string(prop, NULL); \
343 s; \
344 s = of_prop_next_string(prop, s))
345 334
346#else /* CONFIG_OF */ 335#else /* CONFIG_OF */
347 336
@@ -505,12 +494,20 @@ static inline int of_machine_is_compatible(const char *compat)
505 return 0; 494 return 0;
506} 495}
507 496
497static inline const __be32 *of_prop_next_u32(struct property *prop,
498 const __be32 *cur, u32 *pu)
499{
500 return NULL;
501}
502
503static inline const char *of_prop_next_string(struct property *prop,
504 const char *cur)
505{
506 return NULL;
507}
508
508#define of_match_ptr(_ptr) NULL 509#define of_match_ptr(_ptr) NULL
509#define of_match_node(_matches, _node) NULL 510#define of_match_node(_matches, _node) NULL
510#define of_property_for_each_u32(np, propname, prop, p, u) \
511 while (0)
512#define of_property_for_each_string(np, propname, prop, s) \
513 while (0)
514#endif /* CONFIG_OF */ 511#endif /* CONFIG_OF */
515 512
516#ifndef of_node_to_nid 513#ifndef of_node_to_nid
@@ -559,6 +556,18 @@ static inline int of_property_read_u32(const struct device_node *np,
559 return of_property_read_u32_array(np, propname, out_value, 1); 556 return of_property_read_u32_array(np, propname, out_value, 1);
560} 557}
561 558
559#define of_property_for_each_u32(np, propname, prop, p, u) \
560 for (prop = of_find_property(np, propname, NULL), \
561 p = of_prop_next_u32(prop, NULL, &u); \
562 p; \
563 p = of_prop_next_u32(prop, p, &u))
564
565#define of_property_for_each_string(np, propname, prop, s) \
566 for (prop = of_find_property(np, propname, NULL), \
567 s = of_prop_next_string(prop, NULL); \
568 s; \
569 s = of_prop_next_string(prop, s))
570
562#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE) 571#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE)
563extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); 572extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
564extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); 573extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);