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>
This commit is contained in:
Sebastian Andrzej Siewior 2013-06-17 16:48:13 +02:00 коммит произвёл Grant Likely
Родитель 3b2f64d00c
Коммит 2adfffa223
1 изменённых файлов: 24 добавлений и 15 удалений

Просмотреть файл

@ -323,12 +323,6 @@ extern int of_detach_node(struct device_node *);
*/ */
const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur, const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
u32 *pu); u32 *pu);
#define of_property_for_each_u32(np, propname, prop, p, u) \
for (prop = of_find_property(np, propname, NULL), \
p = of_prop_next_u32(prop, NULL, &u); \
p; \
p = of_prop_next_u32(prop, p, &u))
/* /*
* struct property *prop; * struct property *prop;
* const char *s; * const char *s;
@ -337,11 +331,6 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
* printk("String value: %s\n", s); * printk("String value: %s\n", s);
*/ */
const char *of_prop_next_string(struct property *prop, const char *cur); const char *of_prop_next_string(struct property *prop, const char *cur);
#define of_property_for_each_string(np, propname, prop, s) \
for (prop = of_find_property(np, propname, NULL), \
s = of_prop_next_string(prop, NULL); \
s; \
s = of_prop_next_string(prop, s))
#else /* CONFIG_OF */ #else /* CONFIG_OF */
@ -505,12 +494,20 @@ static inline int of_machine_is_compatible(const char *compat)
return 0; return 0;
} }
static inline const __be32 *of_prop_next_u32(struct property *prop,
const __be32 *cur, u32 *pu)
{
return NULL;
}
static inline const char *of_prop_next_string(struct property *prop,
const char *cur)
{
return NULL;
}
#define of_match_ptr(_ptr) NULL #define of_match_ptr(_ptr) NULL
#define of_match_node(_matches, _node) NULL #define of_match_node(_matches, _node) NULL
#define of_property_for_each_u32(np, propname, prop, p, u) \
while (0)
#define of_property_for_each_string(np, propname, prop, s) \
while (0)
#endif /* CONFIG_OF */ #endif /* CONFIG_OF */
#ifndef of_node_to_nid #ifndef of_node_to_nid
@ -559,6 +556,18 @@ static inline int of_property_read_u32(const struct device_node *np,
return of_property_read_u32_array(np, propname, out_value, 1); return of_property_read_u32_array(np, propname, out_value, 1);
} }
#define of_property_for_each_u32(np, propname, prop, p, u) \
for (prop = of_find_property(np, propname, NULL), \
p = of_prop_next_u32(prop, NULL, &u); \
p; \
p = of_prop_next_u32(prop, p, &u))
#define of_property_for_each_string(np, propname, prop, s) \
for (prop = of_find_property(np, propname, NULL), \
s = of_prop_next_string(prop, NULL); \
s; \
s = of_prop_next_string(prop, s))
#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE) #if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE)
extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);