diff options
author | Simon Glass <sjg@chromium.org> | 2020-01-27 18:49:48 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-02-06 05:33:45 +0300 |
commit | 903e83ee84649c1a70bfd8b9ec84dacb8c24e7cb (patch) | |
tree | 3b22285081f2921225d80a4c7437bf618335262a /test/dm/test-fdt.c | |
parent | f262d4ca4b2bf8a99acb37c6151c54cd80251566 (diff) | |
download | u-boot-903e83ee84649c1a70bfd8b9ec84dacb8c24e7cb.tar.xz |
dm: core: Add a way to iterate through children, probing each
It is sometimes useful to process all children, making sure they are
probed first. Add functions to help with this and a macro to make it more
convenient.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm/test-fdt.c')
-rw-r--r-- | test/dm/test-fdt.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index 8fe4425b21..cd65e42a88 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -891,3 +891,22 @@ static int dm_test_child_ofdata(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_child_ofdata, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +/* Test device_first_child_err(), etc. */ +static int dm_test_first_child_probe(struct unit_test_state *uts) +{ + struct udevice *bus, *dev; + int count; + + ut_assertok(uclass_first_device_err(UCLASS_TEST_BUS, &bus)); + count = 0; + device_foreach_child_probe(dev, bus) { + ut_assert(dev->flags & DM_FLAG_PLATDATA_VALID); + ut_assert(dev->flags & DM_FLAG_ACTIVATED); + count++; + } + ut_asserteq(3, count); + + return 0; +} +DM_TEST(dm_test_first_child_probe, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); |