From: Sascha Hauer <s.hauer@pengutronix.de>
To: "open list:BAREBOX" <barebox@lists.infradead.org>
Subject: [PATCH 3/5] of: of_graph: honour ports subnode
Date: Wed, 25 Sep 2024 16:01:13 +0200 [thread overview]
Message-ID: <20240925-of-graph-fixes-v1-3-c0a3ac989b0c@pengutronix.de> (raw)
In-Reply-To: <20240925-of-graph-fixes-v1-0-c0a3ac989b0c@pengutronix.de>
The of_graph ports of a node nowadays are usually collected under a
'ports' subnode instead of being directly under the devices node.
Handle this case correctly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/of/base.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index fbbc3316fc..398e39340f 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -3271,11 +3271,14 @@ EXPORT_SYMBOL(of_graph_parse_endpoint);
*
* Return: A 'port' node pointer with refcount incremented.
*/
-struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id)
+struct device_node *of_graph_get_port_by_id(struct device_node *parent, u32 id)
{
- struct device_node *port;
+ struct device_node *port, *node = of_get_child_by_name(parent, "ports");
+
+ if (node)
+ parent = node;
- for_each_child_of_node(node, port) {
+ for_each_child_of_node(parent, port) {
u32 port_id = 0;
if (strncmp(port->name, "port", 4) != 0)
--
2.39.5
next prev parent reply other threads:[~2024-09-25 14:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-25 14:01 [PATCH 0/5] of-graph fixes Sascha Hauer
2024-09-25 14:01 ` [PATCH 1/5] of: fix of_get_next_child() for prev->parent != node Sascha Hauer
2024-09-25 14:01 ` [PATCH 2/5] of: fix of_graph_get_next_endpoint() Sascha Hauer
2024-09-25 14:01 ` Sascha Hauer [this message]
2024-09-25 14:01 ` [PATCH 4/5] of: of_graph: " Sascha Hauer
2024-09-25 14:01 ` [PATCH 5/5] of: of_graph: add missing functions Sascha Hauer
2024-09-27 10:39 ` [PATCH 0/5] of-graph fixes 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=20240925-of-graph-fixes-v1-3-c0a3ac989b0c@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