aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/unittest.c
diff options
context:
space:
mode:
authorRemo Senekowitsch <remo@buenzli.dev>2025-06-16 17:45:11 +0200
committerDanilo Krummrich <dakr@kernel.org>2025-06-25 17:48:41 +0200
commitc79cbde9b7bc7a650af96269588518950e3c2441 (patch)
tree92da49bc9289a3a8dc64f7687ef2de9af4d6910f /drivers/of/unittest.c
parentrust: device: Add property_get_reference_args (diff)
downloadlinux-c79cbde9b7bc7a650af96269588518950e3c2441.tar.gz
linux-c79cbde9b7bc7a650af96269588518950e3c2441.zip
samples: rust: platform: Add property child and reference args examples
Add some example usage of the device property methods for reading DT/ACPI/swnode child nodes and reference args. Signed-off-by: Remo Senekowitsch <remo@buenzli.dev> Link: https://lore.kernel.org/r/20250616154511.1862909-4-remo@buenzli.dev [ Convert 'child@{0,1}' to 'child-{0,1}'; skip child nodes without 'compatible' property in of_unittest_platform_populate() as proposed by Rob Herring. - Danilo] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'drivers/of/unittest.c')
-rw-r--r--drivers/of/unittest.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index eeb370e0f507..e3503ec20f6c 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1856,6 +1856,8 @@ static void __init of_unittest_platform_populate(void)
of_platform_populate(np, match, NULL, &test_bus->dev);
for_each_child_of_node(np, child) {
for_each_child_of_node(child, grandchild) {
+ if (!of_property_present(grandchild, "compatible"))
+ continue;
pdev = of_find_device_by_node(grandchild);
unittest(pdev,
"Could not create device for node '%pOFn'\n",