mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] of: have of_property_match_string accept pointer to const device_node
@ 2022-12-05 13:32 Ahmad Fatoum
  2022-12-05 13:32 ` [PATCH 2/2] of: platform: port Linux of_dma_is_coherent Ahmad Fatoum
  2022-12-07  6:58 ` [PATCH 1/2] of: have of_property_match_string accept pointer to const device_node Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2022-12-05 13:32 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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@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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-07  6:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-05 13:32 [PATCH 1/2] of: have of_property_match_string accept pointer to const device_node Ahmad Fatoum
2022-12-05 13:32 ` [PATCH 2/2] of: platform: port Linux of_dma_is_coherent Ahmad Fatoum
2022-12-07  6:58 ` [PATCH 1/2] of: have of_property_match_string accept pointer to const device_node Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox