dt: add empty of_property_read_u32[_array] for non-dt
The patch adds empty functions of_property_read_u32 and of_property_read_u32_array for non-dt build, so that drivers migrating to dt can save some '#ifdef CONFIG_OF'. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> [grant.likely: Moved things around so only one new static inline is needed] [grant.likely: Added _string variant] Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This commit is contained in:
@@ -200,13 +200,6 @@ extern int of_property_read_u32_array(const struct device_node *np,
|
|||||||
u32 *out_values,
|
u32 *out_values,
|
||||||
size_t sz);
|
size_t sz);
|
||||||
|
|
||||||
static inline int of_property_read_u32(const struct device_node *np,
|
|
||||||
char *propname,
|
|
||||||
u32 *out_value)
|
|
||||||
{
|
|
||||||
return of_property_read_u32_array(np, propname, out_value, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int of_property_read_string(struct device_node *np, char *propname,
|
extern int of_property_read_string(struct device_node *np, char *propname,
|
||||||
const char **out_string);
|
const char **out_string);
|
||||||
extern int of_device_is_compatible(const struct device_node *device,
|
extern int of_device_is_compatible(const struct device_node *device,
|
||||||
@@ -241,12 +234,32 @@ extern void of_attach_node(struct device_node *);
|
|||||||
extern void of_detach_node(struct device_node *);
|
extern void of_detach_node(struct device_node *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else /* CONFIG_OF */
|
||||||
|
|
||||||
static inline bool of_have_populated_dt(void)
|
static inline bool of_have_populated_dt(void)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int of_property_read_u32_array(const struct device_node *np,
|
||||||
|
char *propname, u32 *out_values, size_t sz)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int of_property_read_string(struct device_node *np,
|
||||||
|
char *propname, const char **out_string)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_OF */
|
#endif /* CONFIG_OF */
|
||||||
|
|
||||||
|
static inline int of_property_read_u32(const struct device_node *np,
|
||||||
|
char *propname,
|
||||||
|
u32 *out_value)
|
||||||
|
{
|
||||||
|
return of_property_read_u32_array(np, propname, out_value, 1);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* _LINUX_OF_H */
|
#endif /* _LINUX_OF_H */
|
||||||
|
Reference in New Issue
Block a user