From: Sascha Hauer <s.hauer@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Subject: [PATCH 1/4] of: fall back to parent-prefixed encoding when address translation fails
Date: Thu, 21 May 2026 10:36:55 +0200 [thread overview]
Message-ID: <20260521-pci-of-dynamic-v1-1-951f1878e378@pengutronix.de> (raw)
In-Reply-To: <20260521-pci-of-dynamic-v1-0-951f1878e378@pengutronix.de>
of_get_reproducible_name() formatted the result of of_translate_address()
as [0x%llx] without checking for OF_BAD_ADDR ((u64)-1). For any node
whose reg can't be translated through the parent's ranges - notably PCI
child nodes whose reg[0] encodes a config-space address (space=0), which
host bridges don't list in ranges - this produced [0xffffffffffffffff]
for every such node, collapsing distinct nodes onto the same name and
making of_find_node_by_reproducible_name() return the wrong sibling.
Fall through to the existing parent-prefixed {offset} branch when
translation fails, so untranslatable siblings get disambiguated by
their parent chain.
Assisted-by: Claude Opus 4.7
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/of/base.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 5297894f60..1244664827 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -3368,7 +3368,14 @@ char *of_get_reproducible_name(struct device_node *node)
if (node->parent && of_get_property(node->parent, "ranges", NULL)) {
addr = of_translate_address(node, reg);
- return basprintf("[0x%llx]", addr);
+ if (addr != OF_BAD_ADDR)
+ return basprintf("[0x%llx]", addr);
+ /*
+ * Untranslatable - e.g. a PCI config-space address whose
+ * tag (space=0) doesn't appear in the parent's ranges.
+ * Fall through to the parent-prefixed encoding so distinct
+ * untranslatable nodes don't all collide on OF_BAD_ADDR.
+ */
}
na = of_n_addr_cells(node);
--
2.47.3
next prev parent reply other threads:[~2026-05-21 8:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 8:36 [PATCH 0/4] PCI: populate PCI host controller device nodes Sascha Hauer
2026-05-21 8:36 ` Sascha Hauer [this message]
2026-05-21 8:36 ` [PATCH 2/4] pci: fix DT node matching when reg encodes a non-zero bus number Sascha Hauer
2026-05-21 8:36 ` [PATCH 3/4] pci: add pci_is_bridge() helper Sascha Hauer
2026-05-21 16:23 ` Bjorn Helgaas
2026-05-21 19:46 ` Sascha Hauer
2026-05-21 20:53 ` Bjorn Helgaas
2026-05-21 8:36 ` [PATCH 4/4] pci: synthesize devicetree nodes for enumerated devices 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=20260521-pci-of-dynamic-v1-1-951f1878e378@pengutronix.de \
--to=s.hauer@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