mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: Bastian Krause <bst@pengutronix.de>
Subject: [PATCH] of: Fix reproducible names for #address-cells != 1
Date: Mon, 18 Mar 2019 12:54:33 +0100	[thread overview]
Message-ID: <20190318115433.31104-1-s.hauer@pengutronix.de> (raw)

For the new "fixed-partitions" binding we ignore the partitions
subnode for creating reproducible names and set node to its parent.
To get the number of address cells we must call of_n_addr_cells()
before setting node to its parent though, not afterwards. With the
current behaviour we always get OF_ROOT_NODE_ADDR_CELLS_DEFAULT (=1).
This happens to work then the partitioned device is less than 4GiB
in size. On bigger devices #address-cells = <2> is chosen by the
mtd partition fixup code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Bastian Krause <bst@pengutronix.de>
---
 drivers/of/base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index b082f0c656..318ba72cb0 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2274,6 +2274,8 @@ char *of_get_reproducible_name(struct device_node *node)
 		return basprintf("[0x%llx]", addr);
 	}
 
+	na = of_n_addr_cells(node);
+
 	/*
 	 * Special workaround for the of partition binding. In the old binding
 	 * the partitions are directly under the hardware devicenode whereas in
@@ -2286,8 +2288,6 @@ char *of_get_reproducible_name(struct device_node *node)
 		node = node->parent;
 	}
 
-	na = of_n_addr_cells(node);
-
 	offset = of_read_number(reg, na);
 
 	str = of_get_reproducible_name(node->parent);
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

                 reply	other threads:[~2019-03-18 11:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190318115433.31104-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=bst@pengutronix.de \
    /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