]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: core: Switch binding to use new sequence numbers
authorSimon Glass <sjg@chromium.org>
Thu, 17 Dec 2020 04:20:11 +0000 (21:20 -0700)
committerSimon Glass <sjg@chromium.org>
Sat, 19 Dec 2020 03:32:21 +0000 (20:32 -0700)
Update the core logic to use the new approach. For now the old code is
left as is. Update one test so it still passes.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/core/device.c
test/dm/bus.c

index 8d1287f9a196a9e1b0a3bedd166d39c426f9a164..1e681333d35f973ac465758a53f78dca198d2080 100644 (file)
@@ -661,12 +661,9 @@ int device_find_child_by_seq(const struct udevice *parent, int seq_or_req_seq,
        struct udevice *dev;
 
        *devp = NULL;
-       if (seq_or_req_seq == -1)
-               return -ENODEV;
 
        list_for_each_entry(dev, &parent->child_head, sibling_node) {
-               if ((find_req_seq ? dev->req_seq : dev_seq(dev)) ==
-                               seq_or_req_seq) {
+               if (dev->sqq == seq_or_req_seq) {
                        *devp = dev;
                        return 0;
                }
index 9e81b1da1f07596111e909c52e6d0af5dd416b0f..77555e52937296735243636512f87ad184921cce 100644 (file)
@@ -159,9 +159,10 @@ static int dm_test_bus_children_funcs(struct unit_test_state *uts)
        ut_asserteq(-ENODEV, device_find_child_by_seq(bus, -1, true, &dev));
        ut_assertok(device_find_child_by_seq(bus, 0, true, &dev));
        ut_assert(!(dev->flags & DM_FLAG_ACTIVATED));
-       ut_asserteq(-ENODEV, device_find_child_by_seq(bus, 0, false, &dev));
+       ut_asserteq(0, device_find_child_by_seq(bus, 0, false, &dev));
        ut_assertok(device_get_child_by_seq(bus, 0, &dev));
        ut_assert(dev->flags & DM_FLAG_ACTIVATED);
+       ut_asserteq(0, device_find_child_by_seq(bus, 0, false, &dev));
 
        /* There is no device with sequence number 2 */
        ut_asserteq(-ENODEV, device_find_child_by_seq(bus, 2, false, &dev));