[PATCH 1/2] of: have of_property_match_string accept pointer to const device_node

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Dec 5 05:32:26 PST 2022


This function need not have mutable access to the device node, so make
the parameter const to allow calling it from more places without
sacrificing cost safety.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/of/base.c | 2 +-
 include/of.h      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 2eee1279a98d..221050a19715 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1049,7 +1049,7 @@ EXPORT_SYMBOL_GPL(of_property_read_string);
  * This function searches a string list property and returns the index
  * 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)
 {
 	struct property *prop = of_find_property(np, propname, NULL);
diff --git a/include/of.h b/include/of.h
index 052d5fcad84c..c19a17584e47 100644
--- a/include/of.h
+++ b/include/of.h
@@ -229,7 +229,7 @@ extern int of_property_read_variable_u64_array(const struct device_node *np,
 extern int of_property_read_string(struct device_node *np,
 				   const char *propname,
 				   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 *string);
 extern int of_property_read_string_helper(const struct device_node *np,
@@ -616,7 +616,7 @@ static inline int of_property_read_string(struct device_node *np,
 	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 *string)
 {
 	return -ENOSYS;
-- 
2.30.2




More information about the barebox mailing list