public inbox for linuxppc-dev@ozlabs.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Jon Loeliger <jdl@freescale.com>
Cc: linuxppc-dev@ozlabs.org
Subject: dtc: Make -Idts -Odts preserve node/property labels
Date: Fri, 2 Nov 2007 16:10:30 +1100	[thread overview]
Message-ID: <20071102051030.GM19839@localhost.localdomain> (raw)

This patch changes -Odts mode output so that labels on properties,
nodes and memreserve entries in input source are preserved in the
output.

Preserving labels within property values is trickier - another patch
coming later.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

Index: dtc/treesource.c
===================================================================
--- dtc.orig/treesource.c	2007-11-02 16:00:19.000000000 +1100
+++ dtc/treesource.c	2007-11-02 16:02:33.000000000 +1100
@@ -176,6 +176,8 @@ static void write_tree_source_node(FILE 
 	struct node *child;
 
 	write_prefix(f, level);
+	if (tree->label)
+		fprintf(f, "%s: ", tree->label);
 	if (tree->name && (*tree->name))
 		fprintf(f, "%s {\n", tree->name);
 	else
@@ -184,8 +186,10 @@ static void write_tree_source_node(FILE 
 	for_each_property(tree, prop) {
 		enum proptype type;
 
-		write_prefix(f, level);
-		fprintf(f, "\t%s", prop->name);
+		write_prefix(f, level+1);
+		if (prop->label)
+			fprintf(f, "%s: ", prop->label);
+		fprintf(f, "%s", prop->name);
 		type = guess_type(prop);
 
 		switch (type) {
@@ -220,6 +224,8 @@ void dt_to_source(FILE *f, struct boot_i
 	struct reserve_info *re;
 
 	for (re = bi->reservelist; re; re = re->next) {
+		if (re->label)
+			fprintf(f, "%s: ", re->label);
 		fprintf(f, "/memreserve/\t%016llx-%016llx;\n",
 			(unsigned long long)re->re.address,
 			(unsigned long long)(re->re.address + re->re.size - 1));

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

             reply	other threads:[~2007-11-02  5:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-02  5:10 David Gibson [this message]
2007-11-05 14:55 ` dtc: Make -Idts -Odts preserve node/property labels Jon Loeliger

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=20071102051030.GM19839@localhost.localdomain \
    --to=david@gibson.dropbear.id.au \
    --cc=jdl@freescale.com \
    --cc=linuxppc-dev@ozlabs.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