Skip to content

Commit

Permalink
of: constify property name parameters for helper functions
Browse files Browse the repository at this point in the history
The helper functions for reading u32 integers, u32 arrays and strings
should have the property name as a const pointer.

Cc: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
  • Loading branch information
Jamie Iles authored and Grant Likely committed Aug 2, 2011
1 parent 5f9288a commit aac285c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
7 changes: 4 additions & 3 deletions drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,9 @@ EXPORT_SYMBOL(of_find_node_by_phandle);
*
* The out_value is modified only if a valid u32 value can be decoded.
*/
int of_property_read_u32_array(const struct device_node *np, char *propname,
u32 *out_values, size_t sz)
int of_property_read_u32_array(const struct device_node *np,
const char *propname, u32 *out_values,
size_t sz)
{
struct property *prop = of_find_property(np, propname, NULL);
const __be32 *val;
Expand Down Expand Up @@ -645,7 +646,7 @@ EXPORT_SYMBOL_GPL(of_property_read_u32_array);
*
* The out_string pointer is modified only if a valid string can be decoded.
*/
int of_property_read_string(struct device_node *np, char *propname,
int of_property_read_string(struct device_node *np, const char *propname,
const char **out_string)
{
struct property *prop = of_find_property(np, propname, NULL);
Expand Down
15 changes: 9 additions & 6 deletions include/linux/of.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,13 @@ extern struct property *of_find_property(const struct device_node *np,
const char *name,
int *lenp);
extern int of_property_read_u32_array(const struct device_node *np,
char *propname,
const char *propname,
u32 *out_values,
size_t sz);

extern int of_property_read_string(struct device_node *np, char *propname,
const char **out_string);
extern int of_property_read_string(struct device_node *np,
const char *propname,
const char **out_string);
extern int of_device_is_compatible(const struct device_node *device,
const char *);
extern int of_device_is_available(const struct device_node *device);
Expand Down Expand Up @@ -242,21 +243,23 @@ static inline bool of_have_populated_dt(void)
}

static inline int of_property_read_u32_array(const struct device_node *np,
char *propname, u32 *out_values, size_t sz)
const 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)
const char *propname,
const char **out_string)
{
return -ENOSYS;
}

#endif /* CONFIG_OF */

static inline int of_property_read_u32(const struct device_node *np,
char *propname,
const char *propname,
u32 *out_value)
{
return of_property_read_u32_array(np, propname, out_value, 1);
Expand Down

0 comments on commit aac285c

Please sign in to comment.