devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Frank Rowand <frowand.list@gmail.com>, devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] of/unittest: remove use of node name pointer in overlay high level test
Date: Tue, 28 Aug 2018 10:52:51 -0500	[thread overview]
Message-ID: <20180828155254.10709-2-robh@kernel.org> (raw)
In-Reply-To: <20180828155254.10709-1-robh@kernel.org>

In preparation for removing the node name pointer, it needs to be
removed from of_unittest_overlay_high_level. However, it's not really
correct to use the node name without the unit-address and we should use
the full node name. This most easily done by iterating over the child
nodes with for_each_child_of_node() which is what of_get_child_by_name()
does internally. While at it, we might as well convert the outer loop to
use for_each_child_of_node() too instead of open coding it.

Cc: Frank Rowand <frowand.list@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/of/unittest.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 722537e14848..69a522e48970 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -2347,10 +2347,12 @@ static __init void of_unittest_overlay_high_level(void)
 		}
 	}
 
-	for (np = overlay_base_root->child; np; np = np->sibling) {
-		if (of_get_child_by_name(of_root, np->name)) {
-			unittest(0, "illegal node name in overlay_base %s",
-				np->name);
+	for_each_child_of_node(overlay_base_root, np) {
+		struct device_node *base_child;
+		for_each_child_of_node(of_root, base_child) {
+			if (!strcmp(np->full_name, base_child->full_name))
+				unittest(0, "illegal node name in overlay_base %pOFn",
+					np);
 			return;
 		}
 	}
-- 
2.17.1

  reply	other threads:[~2018-08-28 15:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 15:52 [PATCH 0/4] of: Convert to using %pOFn for node name printf Rob Herring
2018-08-28 15:52 ` Rob Herring [this message]
2018-08-28 15:52 ` [PATCH 2/4] of/unittest: add printf tests for node name Rob Herring
2018-08-28 15:52 ` [PATCH 3/4] of: Convert to using %pOFn instead of device_node.name Rob Herring
2018-09-07 12:29   ` Thierry Reding
2018-09-07 14:58     ` Rob Herring
2018-09-08  0:30     ` Joe Perches
2018-09-10  9:06       ` Thierry Reding
2018-08-28 15:52 ` [PATCH 4/4] vsprintf: print OF node name using full_name Rob Herring
2018-08-31 23:51 ` [PATCH 0/4] of: Convert to using %pOFn for node name printf Frank Rowand

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=20180828155254.10709-2-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).