mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/3] of: fdt: rename /memreserve special node to /$memreserve
Date: Thu, 19 Dec 2024 12:16:02 +0100	[thread overview]
Message-ID: <20241219111603.1020442-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20241219111603.1020442-1-a.fatoum@pengutronix.de>

/memreserve in the barebox device tree is a special node used to hold
the reserved memory entries in the FDT until the DT is unflattened
again.

To avoid conflicts with an actual device tree node called /memreserve,
let's prefix with '$', the character newly chosen to mark
barebox-specific nodes and properties.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/of/fdt.c          | 14 ++++++--------
 drivers/of/reserved-mem.c |  2 +-
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 6f10094143cd..6c554af61f6f 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -92,7 +92,7 @@ static int of_reservemap_num_entries(const struct fdt_header *fdt)
  * @fdt - the flattened device tree blob
  *
  * This stores the memreserve entries from the dtb in a newly created
- * /memserve node in the unflattened device tree. The device tree
+ * /$memreserve node in the unflattened device tree. The device tree
  * flatten code moves the entries back to the /memreserve/ area in the
  * flattened tree.
  *
@@ -109,7 +109,7 @@ static int of_unflatten_reservemap(struct device_node *root,
 	if (n <= 0)
 		return n;
 
-	memreserve = of_new_node(root, "memreserve");
+	memreserve = of_new_node(root, "$memreserve");
 	if (!memreserve)
 		return -ENOMEM;
 
@@ -462,7 +462,7 @@ static inline int dt_add_string(struct fdt *fdt, const char *str)
 	return ret;
 }
 
-static int __of_flatten_dtb(struct fdt *fdt, struct device_node *node, int is_root)
+static int __of_flatten_dtb(struct fdt *fdt, struct device_node *node)
 {
 	struct property *p;
 	struct device_node *n;
@@ -500,10 +500,8 @@ static int __of_flatten_dtb(struct fdt *fdt, struct device_node *node, int is_ro
 	list_for_each_entry(n, &node->children, parent_list) {
 		if (is_reserved_name(n->name))
 			continue;
-		if (is_root && !strcmp(n->name, "memreserve"))
-			continue;
 
-		ret = __of_flatten_dtb(fdt, n, 0);
+		ret = __of_flatten_dtb(fdt, n);
 		if (ret)
 			return ret;
 	}
@@ -553,11 +551,11 @@ void *of_flatten_dtb(struct device_node *node)
 
 	fdt.dt_nextofs = ofs;
 
-	ret = __of_flatten_dtb(&fdt, node, 1);
+	ret = __of_flatten_dtb(&fdt, node);
 	if (ret)
 		goto out_free;
 
-	memreserve = of_find_node_by_name_address(node, "memreserve");
+	memreserve = of_find_node_by_name_address(node, "$memreserve");
 	if (memreserve) {
 		const void *entries = of_get_property(memreserve, "reg", &len);
 
diff --git a/drivers/of/reserved-mem.c b/drivers/of/reserved-mem.c
index 599a7c968afd..b278026617ac 100644
--- a/drivers/of/reserved-mem.c
+++ b/drivers/of/reserved-mem.c
@@ -52,7 +52,7 @@ static int of_reserved_mem_walk(void)
 		}
 	}
 
-	node = of_find_node_by_path("/memreserve");
+	node = of_find_node_by_path("/$memreserve");
 	reg = of_get_property(node, "reg", &ncells);
 	ncells /= sizeof(__be32);
 	if (reg) {
-- 
2.39.5




  reply	other threads:[~2024-12-19 11:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-19 11:16 [PATCH 1/3] of: fdt: reserve properties and nodes starting with $ for barebox use Ahmad Fatoum
2024-12-19 11:16 ` Ahmad Fatoum [this message]
2024-12-19 11:16 ` [PATCH 3/3] FIT: cache uncompressed data Ahmad Fatoum
2024-12-20  8:19 ` [PATCH 1/3] of: fdt: reserve properties and nodes starting with $ for barebox use Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241219111603.1020442-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox