[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241216-of_core_fix-v2-2-e69b8f60da63@quicinc.com>
Date: Mon, 16 Dec 2024 08:40:41 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>,
Maxime Ripard <mripard@...nel.org>, Robin Murphy <robin.murphy@....com>,
Grant Likely <grant.likely@...retlab.ca>
Cc: Zijun Hu <zijun_hu@...oud.com>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: [PATCH v2 2/7] of: unittest: Add a test case for API
of_find_node_opts_by_path()
From: Zijun Hu <quic_zijuhu@...cinc.com>
To test of_find_node_opts_by_path() take @path argument with pattern:
"alias-name/node-name-1/.../node-name-N:options", for example:
"testcase-alias/phandle-tests/consumer-a:testaliasoption"
Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
drivers/of/unittest.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index daf9a2dddd7e0dbc680f708496b6dce6d23999cf..ed343509505f536436f8457bd200ccc323acffdf 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -161,6 +161,15 @@ static void __init of_unittest_find_node_by_name(void)
"option alias path test, subcase #1 failed\n");
of_node_put(np);
+ np = of_find_node_opts_by_path("testcase-alias/phandle-tests/consumer-a:testaliasoption",
+ &options);
+ name = kasprintf(GFP_KERNEL, "%pOF", np);
+ unittest(np && name && !strcmp("/testcase-data/phandle-tests/consumer-a", name) &&
+ !strcmp("testaliasoption", options),
+ "option alias path test, subcase #2 failed\n");
+ of_node_put(np);
+ kfree(name);
+
np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL);
unittest(np, "NULL option alias path test failed\n");
of_node_put(np);
--
2.34.1
Powered by blists - more mailing lists