From: Simon Glass Date: Wed, 7 Sep 2022 02:27:04 +0000 (-0600) Subject: dm: core: Drop the const from ofnode X-Git-Url: http://git.dujemihanovic.xyz/img/static/git-favicon.png?a=commitdiff_plain;h=98306987659769607642474954b2bf9555808542;p=u-boot.git dm: core: Drop the const from ofnode Now that we support writing to ofnodes, the const is not accurate. Drop it to avoid undesirable casting. Also drop the ofnode_to_npw() which is now the same as ofnode_to_np(). Signed-off-by: Simon Glass --- diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 8683e03c33..caf28c68c4 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -268,7 +268,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)) @@ -1171,7 +1171,7 @@ int ofnode_write_prop(ofnode node, const char *propname, const void *value, int len) { if (of_live_active()) - return of_write_prop(ofnode_to_npw(node), propname, len, value); + return of_write_prop(ofnode_to_np(node), propname, len, value); else return fdt_setprop((void *)gd->fdt_blob, ofnode_to_offset(node), propname, value, len); diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index ec1ab0ce15..044546f005 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()) @@ -44,24 +44,6 @@ static inline const struct device_node *ofnode_to_np(ofnode node) return node.np; } -/** - * ofnode_to_npw() - convert an ofnode to a writeable live DT node pointer - * - * This cannot be called if the reference contains an offset. - * - * @node: Reference containing struct device_node * (possibly invalid) - * Return: pointer to device node (can be NULL) - */ -static inline struct device_node *ofnode_to_npw(ofnode node) -{ -#ifdef OF_CHECKS - if (!of_live_active()) - return NULL; -#endif - /* Drop constant */ - return (struct device_node *)node.np; -} - /** * ofnode_to_offset() - convert an ofnode to a flat DT offset * @@ -117,7 +99,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 266253d5e3..8d0d7885aa 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;