dtoc: Assign a sequence number to each node

Now that we have the alias information we can assign a sequence number
to each device in the uclass. Store this in the node associated with each
device.

This requires renaming the sandbox test drivers to have the right name.
Note that test coverage is broken with this patch, but fixed in the next
one.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2021-02-03 06:01:09 -07:00
parent 1712f8b2b7
commit 074197aadf
4 changed files with 53 additions and 20 deletions

View File

@@ -330,7 +330,7 @@ static int dm_test_fdt_uclass_seq_more(struct unit_test_state *uts)
/* Check creating a device with an alias */
node = ofnode_path("/some-bus/c-test@1");
ut_assertok(device_bind(dm_root(), DM_DRIVER_GET(testfdt_drv),
ut_assertok(device_bind(dm_root(), DM_DRIVER_GET(denx_u_boot_fdt_test),
"c-test@1", NULL, node, &dev));
ut_asserteq(12, dev_seq(dev));
ut_assertok(uclass_get_device_by_seq(UCLASS_TEST_FDT, 12, &dev));
@@ -350,11 +350,11 @@ static int dm_test_fdt_uclass_seq_more(struct unit_test_state *uts)
*
* So next available is 19
*/
ut_assertok(device_bind(dm_root(), DM_DRIVER_GET(testfdt_drv),
ut_assertok(device_bind(dm_root(), DM_DRIVER_GET(denx_u_boot_fdt_test),
"fred", NULL, ofnode_null(), &dev));
ut_asserteq(19, dev_seq(dev));
ut_assertok(device_bind(dm_root(), DM_DRIVER_GET(testfdt_drv),
ut_assertok(device_bind(dm_root(), DM_DRIVER_GET(denx_u_boot_fdt_test),
"fred2", NULL, ofnode_null(), &dev));
ut_asserteq(20, dev_seq(dev));