diff mbox series

[v3,3/5] test: create dedicated fdt node for ofnode_for_each_prop test

Message ID 20230122152125.858085-4-dsankouski@gmail.com
State Accepted
Commit 298ffdd5d65c4d67b958080c1a712f8f1c923af3
Delegated to: Tom Rini
Headers show
Series dm: input: driver for buttons with linux, code declaration | expand

Commit Message

Dzmitry Sankouski Jan. 22, 2023, 3:21 p.m. UTC
Property count may change in /buttons node, if more button tests added,
and this will break ofnode_for_each_prop.
Add separate node for mentioned test.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
---
Changes for v2: N/A
Changes for v3: N/A

 arch/sandbox/dts/test.dts | 14 ++++++++++++++
 test/dm/ofnode.c          |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

Comments

Simon Glass Jan. 23, 2023, 6:42 p.m. UTC | #1
On Sun, 22 Jan 2023 at 08:21, Dzmitry Sankouski <dsankouski@gmail.com> wrote:
>
> Property count may change in /buttons node, if more button tests added,
> and this will break ofnode_for_each_prop.
> Add separate node for mentioned test.
>
> Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
> ---
> Changes for v2: N/A
> Changes for v3: N/A
>
>  arch/sandbox/dts/test.dts | 14 ++++++++++++++
>  test/dm/ofnode.c          |  2 +-
>  2 files changed, 15 insertions(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini Feb. 10, 2023, 6:43 p.m. UTC | #2
On Sun, Jan 22, 2023 at 06:21:23PM +0300, Dzmitry Sankouski wrote:

> Property count may change in /buttons node, if more button tests added,
> and this will break ofnode_for_each_prop.
> Add separate node for mentioned test.
> 
> Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 2e580f980f..06ad027638 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -1517,6 +1517,20 @@ 
 		};
 	};
 
+	ofnode-foreach {
+		compatible = "foreach";
+
+		first {
+			prop1 = <1>;
+			prop2 = <2>;
+		};
+
+		second {
+			prop1 = <1>;
+			prop2 = <2>;
+		};
+	};
+
 	osd {
 		compatible = "sandbox,sandbox_osd";
 	};
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index 8077affabb..473a8cef57 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -1046,7 +1046,7 @@  static int dm_test_ofnode_for_each_prop(struct unit_test_state *uts)
 	struct ofprop prop;
 	int count;
 
-	node = ofnode_path("/buttons");
+	node = ofnode_path("/ofnode-foreach");
 	count = 0;
 
 	/* we expect "compatible" for each node */