From: Zijun Hu Date: Mon, 16 Dec 2024 00:40:41 +0000 (+0800) Subject: of: unittest: Add a test case for of_find_node_opts_by_path() with alias+path+options X-Git-Tag: v6.14-rc1~100^2~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c1b4b91a5e5532602e40b3abe14e6e464d3499f9;p=thirdparty%2Flinux.git of: unittest: Add a test case for of_find_node_opts_by_path() with alias+path+options 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 Link: https://lore.kernel.org/r/20241216-of_core_fix-v2-2-e69b8f60da63@quicinc.com Signed-off-by: Rob Herring (Arm) --- diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index daf9a2dddd7e0..ed343509505f5 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);