diff options
author | Rob Herring <robh@kernel.org> | 2014-05-13 10:07:54 -0500 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2014-05-13 14:11:11 -0500 |
commit | fb2caa50fbacd21719a90dd66b617ce3cb4fd6d7 (patch) | |
tree | 4a4766604759d418b75c8567cf8f0fdeaa85b59d /drivers/of/selftest.c | |
parent | 7d1cdc89c54d2cb8157cf1f36fc65e8583d26484 (diff) |
of/selftest: add testcase for nodes with same name and address
Add a test case for nodes which have the same name and same
non-translatable unit address.
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Reviewed-by: Frank Rowand <frank.rowand@sonymobile.com>
Diffstat (limited to 'drivers/of/selftest.c')
-rw-r--r-- | drivers/of/selftest.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index c1d7d38009f..2588faaaa30 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c @@ -431,8 +431,12 @@ static void __init of_selftest_match_node(void) static void __init of_selftest_platform_populate(void) { int irq; - struct device_node *np; + struct device_node *np, *child; struct platform_device *pdev; + struct of_device_id match[] = { + { .compatible = "test-device", }, + {} + }; np = of_find_node_by_path("/testcase-data"); of_platform_populate(np, of_default_bus_match_table, NULL, NULL); @@ -452,6 +456,20 @@ static void __init of_selftest_platform_populate(void) irq = platform_get_irq(pdev, 0); selftest(irq < 0 && irq != -EPROBE_DEFER, "device parsing error failed - %d\n", irq); + np = of_find_node_by_path("/testcase-data/platform-tests"); + if (!np) { + pr_err("No testcase data in device tree\n"); + return; + } + + for_each_child_of_node(np, child) { + struct device_node *grandchild; + of_platform_populate(child, match, NULL, NULL); + for_each_child_of_node(child, grandchild) + selftest(of_find_device_by_node(grandchild), + "Could not create device for node '%s'\n", + grandchild->name); + } } static int __init of_selftest(void) |