summaryrefslogtreecommitdiff
path: root/test/dm
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-12-17 07:20:32 +0300
committerSimon Glass <sjg@chromium.org>2020-12-19 06:32:21 +0300
commit7f20d1d24989fedaad28689c0454f91d44453e80 (patch)
treef185c71d1f3f35bbcbff8fddd6551f05d309ec75 /test/dm
parent36c03d183041e57714a909f6d020ac10ef279e3b (diff)
downloadu-boot-7f20d1d24989fedaad28689c0454f91d44453e80.tar.xz
dm: core: Drop seq and req_seq
Now that migration to the new sequence numbers is complete, drop the old fields. Add a test that covers the new behaviour. Also drop the check for OF_PRIOR_STAGE since we always assign sequence numbers now. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm')
-rw-r--r--test/dm/test-fdt.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index 5f443bdb6c..eb3c2cf161 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -441,6 +441,45 @@ static int dm_test_fdt_uclass_seq_manual(struct unit_test_state *uts)
}
DM_TEST(dm_test_fdt_uclass_seq_manual, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+static int dm_test_fdt_uclass_seq_more(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+ ofnode node;
+
+ /* Check creating a device with an alias */
+ node = ofnode_path("/some-bus/c-test@1");
+ ut_assertok(device_bind(dm_root(), DM_GET_DRIVER(testfdt_drv),
+ "c-test@1", NULL, node, &dev));
+ ut_asserteq(12, dev_seq(dev));
+ ut_assertok(uclass_get_device_by_seq(UCLASS_TEST_FDT, 12, &dev));
+ ut_asserteq_str("c-test@1", dev->name);
+
+ /*
+ * Now bind a device without an alias. It should not get the next
+ * sequence number after all aliases, and existing bound devices. The
+ * last alias is 12, so we have:
+ *
+ * 13 d-test
+ * 14 f-test
+ * 15 g-test
+ * 16 h-test
+ * 17 another-test
+ * 18 chosen-test
+ *
+ * So next available is 19
+ */
+ ut_assertok(device_bind(dm_root(), DM_GET_DRIVER(testfdt_drv),
+ "fred", NULL, ofnode_null(), &dev));
+ ut_asserteq(19, dev_seq(dev));
+
+ ut_assertok(device_bind(dm_root(), DM_GET_DRIVER(testfdt_drv),
+ "fred2", NULL, ofnode_null(), &dev));
+ ut_asserteq(20, dev_seq(dev));
+
+ return 0;
+}
+DM_TEST(dm_test_fdt_uclass_seq_more, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+
/* Test that we can find a device by device tree offset */
static int dm_test_fdt_offset(struct unit_test_state *uts)
{