[PATCH 10/21] dm: core: Drop the const from ofnode

Simon Glass sjg at chromium.org
Wed Aug 31 05:08:06 CEST 2022


Now that we support writing to ofnodes, the const is not accurate. Drop
it to avoid undesirable casting.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 drivers/core/ofnode.c    | 2 +-
 include/dm/ofnode.h      | 4 ++--
 include/dm/ofnode_decl.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index f01bfac8f69..8da4784253d 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -206,7 +206,7 @@ ofnode ofnode_find_subnode(ofnode node, const char *subnode_name)
 	debug("%s: %s: ", __func__, subnode_name);
 
 	if (ofnode_is_np(node)) {
-		const struct device_node *np = ofnode_to_np(node);
+		struct device_node *np = ofnode_to_np(node);
 
 		for (np = np->child; np; np = np->sibling) {
 			if (!strcmp(subnode_name, np->name))
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index ebef8a6e2bb..3b7ef793057 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -35,7 +35,7 @@ struct ofnode_phandle_args {
  * @node: Reference containing struct device_node * (possibly invalid)
  * Return: pointer to device node (can be NULL)
  */
-static inline const struct device_node *ofnode_to_np(ofnode node)
+static inline struct device_node *ofnode_to_np(ofnode node)
 {
 #ifdef OF_CHECKS
 	if (!of_live_active())
@@ -117,7 +117,7 @@ static inline ofnode offset_to_ofnode(int of_offset)
  * @np: Live node pointer (can be NULL)
  * Return: reference to the associated node pointer
  */
-static inline ofnode np_to_ofnode(const struct device_node *np)
+static inline ofnode np_to_ofnode(struct device_node *np)
 {
 	ofnode node;
 
diff --git a/include/dm/ofnode_decl.h b/include/dm/ofnode_decl.h
index 266253d5e33..8d0d7885aa6 100644
--- a/include/dm/ofnode_decl.h
+++ b/include/dm/ofnode_decl.h
@@ -39,7 +39,7 @@
  *	is not a really a pointer to a node: it is an offset value. See above.
  */
 typedef union ofnode_union {
-	const struct device_node *np;
+	struct device_node *np;
 	long of_offset;
 } ofnode;
 
-- 
2.37.2.672.g94769d06f0-goog



More information about the U-Boot mailing list