提交 fe99c707 编写于 作者: D David Rivshin 提交者: Rob Herring

of: add 'const' for of_property_*_string*() parameter '*np'

The of_property_{read,count,match}_string* family of functions never
modify the struct device_node pointer that is passed in, so there is no
reason for it to be non-const. Equivalent functions for all other types
already take a 'const struct device_node *np'.
Signed-off-by: NDavid Rivshin <drivshin@allworx.com>
Signed-off-by: NRob Herring <robh@kernel.org>
上级 815d74b3
...@@ -1341,10 +1341,10 @@ EXPORT_SYMBOL_GPL(of_property_read_u64_array); ...@@ -1341,10 +1341,10 @@ EXPORT_SYMBOL_GPL(of_property_read_u64_array);
* *
* The out_string pointer is modified only if a valid string can be decoded. * The out_string pointer is modified only if a valid string can be decoded.
*/ */
int of_property_read_string(struct device_node *np, const char *propname, int of_property_read_string(const struct device_node *np, const char *propname,
const char **out_string) const char **out_string)
{ {
struct property *prop = of_find_property(np, propname, NULL); const struct property *prop = of_find_property(np, propname, NULL);
if (!prop) if (!prop)
return -EINVAL; return -EINVAL;
if (!prop->value) if (!prop->value)
...@@ -1365,10 +1365,10 @@ EXPORT_SYMBOL_GPL(of_property_read_string); ...@@ -1365,10 +1365,10 @@ EXPORT_SYMBOL_GPL(of_property_read_string);
* This function searches a string list property and returns the index * This function searches a string list property and returns the index
* of a specific string value. * of a specific string value.
*/ */
int of_property_match_string(struct device_node *np, const char *propname, int of_property_match_string(const struct device_node *np, const char *propname,
const char *string) const char *string)
{ {
struct property *prop = of_find_property(np, propname, NULL); const struct property *prop = of_find_property(np, propname, NULL);
size_t l; size_t l;
int i; int i;
const char *p, *end; const char *p, *end;
...@@ -1404,10 +1404,11 @@ EXPORT_SYMBOL_GPL(of_property_match_string); ...@@ -1404,10 +1404,11 @@ EXPORT_SYMBOL_GPL(of_property_match_string);
* Don't call this function directly. It is a utility helper for the * Don't call this function directly. It is a utility helper for the
* of_property_read_string*() family of functions. * of_property_read_string*() family of functions.
*/ */
int of_property_read_string_helper(struct device_node *np, const char *propname, int of_property_read_string_helper(const struct device_node *np,
const char **out_strs, size_t sz, int skip) const char *propname, const char **out_strs,
size_t sz, int skip)
{ {
struct property *prop = of_find_property(np, propname, NULL); const struct property *prop = of_find_property(np, propname, NULL);
int l = 0, i = 0; int l = 0, i = 0;
const char *p, *end; const char *p, *end;
......
...@@ -296,13 +296,13 @@ extern int of_property_read_u64_array(const struct device_node *np, ...@@ -296,13 +296,13 @@ extern int of_property_read_u64_array(const struct device_node *np,
u64 *out_values, u64 *out_values,
size_t sz); size_t sz);
extern int of_property_read_string(struct device_node *np, extern int of_property_read_string(const struct device_node *np,
const char *propname, const char *propname,
const char **out_string); const char **out_string);
extern int of_property_match_string(struct device_node *np, extern int of_property_match_string(const struct device_node *np,
const char *propname, const char *propname,
const char *string); const char *string);
extern int of_property_read_string_helper(struct device_node *np, extern int of_property_read_string_helper(const struct device_node *np,
const char *propname, const char *propname,
const char **out_strs, size_t sz, int index); const char **out_strs, size_t sz, int index);
extern int of_device_is_compatible(const struct device_node *device, extern int of_device_is_compatible(const struct device_node *device,
...@@ -538,14 +538,14 @@ static inline int of_property_read_u64_array(const struct device_node *np, ...@@ -538,14 +538,14 @@ static inline int of_property_read_u64_array(const struct device_node *np,
return -ENOSYS; return -ENOSYS;
} }
static inline int of_property_read_string(struct device_node *np, static inline int of_property_read_string(const struct device_node *np,
const char *propname, const char *propname,
const char **out_string) const char **out_string)
{ {
return -ENOSYS; return -ENOSYS;
} }
static inline int of_property_read_string_helper(struct device_node *np, static inline int of_property_read_string_helper(const struct device_node *np,
const char *propname, const char *propname,
const char **out_strs, size_t sz, int index) const char **out_strs, size_t sz, int index)
{ {
...@@ -571,7 +571,7 @@ static inline int of_property_read_u64(const struct device_node *np, ...@@ -571,7 +571,7 @@ static inline int of_property_read_u64(const struct device_node *np,
return -ENOSYS; return -ENOSYS;
} }
static inline int of_property_match_string(struct device_node *np, static inline int of_property_match_string(const struct device_node *np,
const char *propname, const char *propname,
const char *string) const char *string)
{ {
...@@ -773,7 +773,7 @@ static inline int of_property_count_u64_elems(const struct device_node *np, ...@@ -773,7 +773,7 @@ static inline int of_property_count_u64_elems(const struct device_node *np,
* *
* If @out_strs is NULL, the number of strings in the property is returned. * If @out_strs is NULL, the number of strings in the property is returned.
*/ */
static inline int of_property_read_string_array(struct device_node *np, static inline int of_property_read_string_array(const struct device_node *np,
const char *propname, const char **out_strs, const char *propname, const char **out_strs,
size_t sz) size_t sz)
{ {
...@@ -792,7 +792,7 @@ static inline int of_property_read_string_array(struct device_node *np, ...@@ -792,7 +792,7 @@ static inline int of_property_read_string_array(struct device_node *np,
* does not have a value, and -EILSEQ if the string is not null-terminated * does not have a value, and -EILSEQ if the string is not null-terminated
* within the length of the property data. * within the length of the property data.
*/ */
static inline int of_property_count_strings(struct device_node *np, static inline int of_property_count_strings(const struct device_node *np,
const char *propname) const char *propname)
{ {
return of_property_read_string_helper(np, propname, NULL, 0, 0); return of_property_read_string_helper(np, propname, NULL, 0, 0);
...@@ -816,7 +816,7 @@ static inline int of_property_count_strings(struct device_node *np, ...@@ -816,7 +816,7 @@ static inline int of_property_count_strings(struct device_node *np,
* *
* The out_string pointer is modified only if a valid string can be decoded. * The out_string pointer is modified only if a valid string can be decoded.
*/ */
static inline int of_property_read_string_index(struct device_node *np, static inline int of_property_read_string_index(const struct device_node *np,
const char *propname, const char *propname,
int index, const char **output) int index, const char **output)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册