]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: core: Access device flags through functions
authorSimon Glass <sjg@chromium.org>
Sat, 19 Dec 2020 17:40:10 +0000 (10:40 -0700)
committerSimon Glass <sjg@chromium.org>
Tue, 5 Jan 2021 19:24:41 +0000 (12:24 -0700)
At present flags are stored as part of the device. In preparation for
storing them separately, change the access to go through inline functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 files changed:
cmd/remoteproc.c
drivers/clk/clk.c
drivers/core/device-remove.c
drivers/core/device.c
drivers/core/devres.c
drivers/core/dump.c
drivers/mtd/nand/raw/octeontx_nand.c
drivers/remoteproc/rproc-uclass.c
drivers/serial/serial-uclass.c
include/dm/device.h
include/virtio.h
test/dm/bus.c
test/dm/core.c
test/dm/cpu.c
test/dm/test-fdt.c
test/dm/virtio.c

index 5f9ba925609fc97df81e4ac1716f89006b64d1b0..b3ddcebe314268ed601ae1667d7867ec1b2344cc 100644 (file)
@@ -35,7 +35,7 @@ static int print_remoteproc_list(void)
                uc_pdata = dev_get_uclass_plat(dev);
 
                /* Do not print if rproc is not probed */
-               if (!(dev->flags & DM_FLAG_ACTIVATED))
+               if (!(dev_get_flags(dev) & DM_FLAG_ACTIVATED))
                        continue;
 
                switch (uc_pdata->mem_type) {
index eb75132f27e880baf566f9a047910b2235d69571..1efb7fe9f3e305c7114e77709a2515e9ba1dcc81 100644 (file)
@@ -67,7 +67,7 @@ const char *clk_hw_get_name(const struct clk *hw)
 
 bool clk_dev_binded(struct clk *clk)
 {
-       if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND))
+       if (clk->dev && (dev_get_flags(clk->dev) & DM_FLAG_BOUND))
                return true;
 
        return false;
index e15ab051be765e0de50fd15313b98e450a398990..44eaa67d56674527275ac2c8767dcce42fe7f2d8 100644 (file)
@@ -69,10 +69,10 @@ int device_unbind(struct udevice *dev)
        if (!dev)
                return log_msg_ret("dev", -EINVAL);
 
-       if (dev->flags & DM_FLAG_ACTIVATED)
+       if (dev_get_flags(dev) & DM_FLAG_ACTIVATED)
                return log_msg_ret("active", -EINVAL);
 
-       if (!(dev->flags & DM_FLAG_BOUND))
+       if (!(dev_get_flags(dev) & DM_FLAG_BOUND))
                return log_msg_ret("not-bound", -EINVAL);
 
        drv = dev->driver;
@@ -88,15 +88,15 @@ int device_unbind(struct udevice *dev)
        if (ret)
                return log_msg_ret("child unbind", ret);
 
-       if (dev->flags & DM_FLAG_ALLOC_PDATA) {
+       if (dev_get_flags(dev) & DM_FLAG_ALLOC_PDATA) {
                free(dev_get_plat(dev));
                dev_set_plat(dev, NULL);
        }
-       if (dev->flags & DM_FLAG_ALLOC_UCLASS_PDATA) {
+       if (dev_get_flags(dev) & DM_FLAG_ALLOC_UCLASS_PDATA) {
                free(dev_get_uclass_plat(dev));
                dev_set_uclass_plat(dev, NULL);
        }
-       if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) {
+       if (dev_get_flags(dev) & DM_FLAG_ALLOC_PARENT_PDATA) {
                free(dev_get_parent_plat(dev));
                dev_set_parent_plat(dev, NULL);
        }
@@ -109,7 +109,7 @@ int device_unbind(struct udevice *dev)
 
        devres_release_all(dev);
 
-       if (dev->flags & DM_FLAG_NAME_ALLOCED)
+       if (dev_get_flags(dev) & DM_FLAG_NAME_ALLOCED)
                free((char *)dev->name);
        free(dev);
 
@@ -144,7 +144,7 @@ void device_free(struct udevice *dev)
                        dev_set_parent_priv(dev, NULL);
                }
        }
-       dev->flags &= ~DM_FLAG_PLATDATA_VALID;
+       dev_bic_flags(dev, DM_FLAG_PLATDATA_VALID);
 
        devres_release_probe(dev);
 }
@@ -166,7 +166,7 @@ int device_remove(struct udevice *dev, uint flags)
        if (!dev)
                return -EINVAL;
 
-       if (!(dev->flags & DM_FLAG_ACTIVATED))
+       if (!(dev_get_flags(dev) & DM_FLAG_ACTIVATED))
                return 0;
 
        drv = dev->driver;
@@ -207,7 +207,7 @@ int device_remove(struct udevice *dev, uint flags)
        if (flags_remove(flags, drv->flags)) {
                device_free(dev);
 
-               dev->flags &= ~DM_FLAG_ACTIVATED;
+               dev_bic_flags(dev, DM_FLAG_ACTIVATED);
        }
 
        return ret;
index f4ae7786ee96b25535a83a77753ec752e6e96825..ba50d46effeb9b23903a97318012df80b6e4c210 100644 (file)
@@ -96,13 +96,13 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
 
                if (CONFIG_IS_ENABLED(OF_PLATDATA)) {
                        if (of_plat_size) {
-                               dev->flags |= DM_FLAG_OF_PLATDATA;
+                               dev_or_flags(dev, DM_FLAG_OF_PLATDATA);
                                if (of_plat_size < drv->plat_auto)
                                        alloc = true;
                        }
                }
                if (alloc) {
-                       dev->flags |= DM_FLAG_ALLOC_PDATA;
+                       dev_or_flags(dev, DM_FLAG_ALLOC_PDATA);
                        ptr = calloc(1, drv->plat_auto);
                        if (!ptr) {
                                ret = -ENOMEM;
@@ -116,7 +116,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
 
        size = uc->uc_drv->per_device_plat_auto;
        if (size) {
-               dev->flags |= DM_FLAG_ALLOC_UCLASS_PDATA;
+               dev_or_flags(dev, DM_FLAG_ALLOC_UCLASS_PDATA);
                ptr = calloc(1, size);
                if (!ptr) {
                        ret = -ENOMEM;
@@ -131,7 +131,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
                        size = parent->uclass->uc_drv->per_child_plat_auto;
                }
                if (size) {
-                       dev->flags |= DM_FLAG_ALLOC_PARENT_PDATA;
+                       dev_or_flags(dev, DM_FLAG_ALLOC_PARENT_PDATA);
                        ptr = calloc(1, size);
                        if (!ptr) {
                                ret = -ENOMEM;
@@ -169,7 +169,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
        if (devp)
                *devp = dev;
 
-       dev->flags |= DM_FLAG_BOUND;
+       dev_or_flags(dev, DM_FLAG_BOUND);
 
        return 0;
 
@@ -193,18 +193,18 @@ fail_bind:
 fail_uclass_bind:
        if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) {
                list_del(&dev->sibling_node);
-               if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) {
+               if (dev_get_flags(dev) & DM_FLAG_ALLOC_PARENT_PDATA) {
                        free(dev_get_parent_plat(dev));
                        dev_set_parent_plat(dev, NULL);
                }
        }
 fail_alloc3:
-       if (dev->flags & DM_FLAG_ALLOC_UCLASS_PDATA) {
+       if (dev_get_flags(dev) & DM_FLAG_ALLOC_UCLASS_PDATA) {
                free(dev_get_uclass_plat(dev));
                dev_set_uclass_plat(dev, NULL);
        }
 fail_alloc2:
-       if (dev->flags & DM_FLAG_ALLOC_PDATA) {
+       if (dev_get_flags(dev) & DM_FLAG_ALLOC_PDATA) {
                free(dev_get_plat(dev));
                dev_set_plat(dev, NULL);
        }
@@ -379,7 +379,7 @@ int device_of_to_plat(struct udevice *dev)
        if (!dev)
                return -EINVAL;
 
-       if (dev->flags & DM_FLAG_PLATDATA_VALID)
+       if (dev_get_flags(dev) & DM_FLAG_PLATDATA_VALID)
                return 0;
 
        /* Ensure all parents have ofdata */
@@ -394,7 +394,7 @@ int device_of_to_plat(struct udevice *dev)
                 * (e.g. PCI bridge devices). Test the flags again
                 * so that we don't mess up the device.
                 */
-               if (dev->flags & DM_FLAG_PLATDATA_VALID)
+               if (dev_get_flags(dev) & DM_FLAG_PLATDATA_VALID)
                        return 0;
        }
 
@@ -412,7 +412,7 @@ int device_of_to_plat(struct udevice *dev)
                        goto fail;
        }
 
-       dev->flags |= DM_FLAG_PLATDATA_VALID;
+       dev_or_flags(dev, DM_FLAG_PLATDATA_VALID);
 
        return 0;
 fail:
@@ -429,7 +429,7 @@ int device_probe(struct udevice *dev)
        if (!dev)
                return -EINVAL;
 
-       if (dev->flags & DM_FLAG_ACTIVATED)
+       if (dev_get_flags(dev) & DM_FLAG_ACTIVATED)
                return 0;
 
        drv = dev->driver;
@@ -451,11 +451,11 @@ int device_probe(struct udevice *dev)
                 * (e.g. PCI bridge devices). Test the flags again
                 * so that we don't mess up the device.
                 */
-               if (dev->flags & DM_FLAG_ACTIVATED)
+               if (dev_get_flags(dev) & DM_FLAG_ACTIVATED)
                        return 0;
        }
 
-       dev->flags |= DM_FLAG_ACTIVATED;
+       dev_or_flags(dev, DM_FLAG_ACTIVATED);
 
        /*
         * Process pinctrl for everything except the root device, and
@@ -515,7 +515,7 @@ fail_uclass:
                        __func__, dev->name);
        }
 fail:
-       dev->flags &= ~DM_FLAG_ACTIVATED;
+       dev_bic_flags(dev, DM_FLAG_ACTIVATED);
 
        device_free(dev);
 
@@ -965,7 +965,7 @@ bool device_is_last_sibling(const struct udevice *dev)
 
 void device_set_name_alloced(struct udevice *dev)
 {
-       dev->flags |= DM_FLAG_NAME_ALLOCED;
+       dev_or_flags(dev, DM_FLAG_NAME_ALLOCED);
 }
 
 int device_set_name(struct udevice *dev, const char *name)
index 522b07d613f8b88110da9fe5d7b875e28f99f965..313ddc7089c967288887c53a2280a3d3e7caf4e0 100644 (file)
@@ -107,9 +107,9 @@ void devres_add(struct udevice *dev, void *res)
 
        devres_log(dev, dr, "ADD");
        assert_noisy(list_empty(&dr->entry));
-       if (dev->flags & DM_FLAG_PLATDATA_VALID)
+       if (dev_get_flags(dev) & DM_FLAG_PLATDATA_VALID)
                dr->phase = DEVRES_PHASE_PROBE;
-       else if (dev->flags & DM_FLAG_BOUND)
+       else if (dev_get_flags(dev) & DM_FLAG_BOUND)
                dr->phase = DEVRES_PHASE_OFDATA;
        else
                dr->phase = DEVRES_PHASE_BIND;
index 1d4628abc74fe5f8124f0f3d402b62868389c382..f8afea30a9351cd83243e221bdb2d4dfb84a967a 100644 (file)
@@ -14,7 +14,7 @@ static void show_devices(struct udevice *dev, int depth, int last_flag)
 {
        int i, is_last;
        struct udevice *child;
-       u32 flags = dev->flags;
+       u32 flags = dev_get_flags(dev);
 
        /* print the first 20 characters to not break the tree-format. */
        printf(IS_ENABLED(CONFIG_SPL_BUILD) ? " %s  %d  [ %c ]   %s  " :
@@ -67,7 +67,7 @@ void dm_dump_all(void)
 static void dm_display_line(struct udevice *dev, int index)
 {
        printf("%-3i %c %s @ %08lx", index,
-              dev->flags & DM_FLAG_ACTIVATED ? '*' : ' ',
+              dev_get_flags(dev) & DM_FLAG_ACTIVATED ? '*' : ' ',
               dev->name, (ulong)map_to_sysmem(dev));
        if (dev->seq_ != -1)
                printf(", seq %d", dev_seq(dev));
index b1ed4d910a76e95bb2aa4f2162567ec745f4c0a0..96a5fe6592a05a618f2730cf0bc2a8ced5b48308 100644 (file)
@@ -2187,7 +2187,7 @@ int octeontx_pci_nand_deferred_probe(void)
        debug("%s: Performing deferred probing\n", __func__);
        list_for_each_entry(pdev, &octeontx_pci_nand_deferred_devices, list) {
                debug("%s: Probing %s\n", __func__, pdev->dev->name);
-               pdev->dev->flags &= ~DM_FLAG_ACTIVATED;
+               dev_get_flags(pdev->dev) &= ~DM_FLAG_ACTIVATED;
                rc = device_probe(pdev->dev);
                if (rc && rc != -ENODEV) {
                        printf("%s: Error %d with deferred probe of %s\n",
index 773b8119f4f7561e314117149419801f515df9af..c2d6a4e0c17ed74c687a715118bdd3f87fcf4b8a 100644 (file)
@@ -247,7 +247,7 @@ static int _rproc_dev_is_probed(struct udevice *dev,
                            struct dm_rproc_uclass_pdata *uc_pdata,
                            const void *data)
 {
-       if (dev->flags & DM_FLAG_ACTIVATED)
+       if (dev_get_flags(dev) & DM_FLAG_ACTIVATED)
                return 0;
 
        return -EAGAIN;
index b6457242dea0ac9f891cea569163554e7d9c4188..58a6541d8cc31ea0121a81e5fa2932d1ac55f4c7 100644 (file)
@@ -123,7 +123,7 @@ static void serial_find_console_or_panic(void)
 #ifdef CONFIG_SERIAL_SEARCH_ALL
                if (!uclass_get_device_by_seq(UCLASS_SERIAL, INDEX, &dev) ||
                    !uclass_get_device(UCLASS_SERIAL, INDEX, &dev)) {
-                       if (dev->flags & DM_FLAG_ACTIVATED) {
+                       if (dev_get_flags(dev) & DM_FLAG_ACTIVATED) {
                                gd->cur_serial_dev = dev;
                                return;
                        }
index a063bbaa17674325980b8a9b358d25a9b2241e90..4ec423e96185e8ba24259e2b230ffdae87da15bf 100644 (file)
@@ -179,6 +179,21 @@ struct udevice {
 /* Returns non-zero if the device is active (probed and not removed) */
 #define device_active(dev)     ((dev)->flags & DM_FLAG_ACTIVATED)
 
+static inline u32 dev_get_flags(const struct udevice *dev)
+{
+       return dev->flags;
+}
+
+static inline void dev_or_flags(struct udevice *dev, u32 or)
+{
+       dev->flags |= or;
+}
+
+static inline void dev_bic_flags(struct udevice *dev, u32 bic)
+{
+       dev->flags &= ~bic;
+}
+
 static inline int dev_of_offset(const struct udevice *dev)
 {
        return ofnode_to_offset(dev->node);
index 10a9c073ba1183547054b3cf5ec4bcebc60f85a0..a42bdad6b871799fe1aa8b03668ad3c88221d36c 100644 (file)
@@ -492,7 +492,7 @@ static inline void __virtio_clear_bit(struct udevice *udev, unsigned int fbit)
  */
 static inline bool virtio_has_feature(struct udevice *vdev, unsigned int fbit)
 {
-       if (!(vdev->flags & DM_FLAG_BOUND))
+       if (!(dev_get_flags(vdev) & DM_FLAG_BOUND))
                WARN_ON(true);
 
        return __virtio_test_bit(vdev->parent, fbit);
index 785ccfc25d1f1959765d7e45665dfc365fc66a34..e768eab6957a62414493853fc108faaaa203076d 100644 (file)
@@ -55,16 +55,16 @@ static int dm_test_bus_children_funcs(struct unit_test_state *uts)
        ut_assertok(device_get_child(bus, 0, &dev));
        ut_asserteq(-ENODEV, device_get_child(bus, 4, &dev));
        ut_assertok(device_get_child_by_seq(bus, 5, &dev));
-       ut_assert(dev->flags & DM_FLAG_ACTIVATED);
+       ut_assert(dev_get_flags(dev) & DM_FLAG_ACTIVATED);
        ut_asserteq_str("c-test@5", dev->name);
 
        /* Device with sequence number 0 should be accessible */
        ut_asserteq(-ENODEV, device_find_child_by_seq(bus, -1, &dev));
        ut_assertok(device_find_child_by_seq(bus, 0, &dev));
-       ut_assert(!(dev->flags & DM_FLAG_ACTIVATED));
+       ut_assert(!(dev_get_flags(dev) & DM_FLAG_ACTIVATED));
        ut_asserteq(0, device_find_child_by_seq(bus, 0, &dev));
        ut_assertok(device_get_child_by_seq(bus, 0, &dev));
-       ut_assert(dev->flags & DM_FLAG_ACTIVATED);
+       ut_assert(dev_get_flags(dev) & DM_FLAG_ACTIVATED);
        ut_asserteq(0, device_find_child_by_seq(bus, 0, &dev));
 
        /* There is no device with sequence number 2 */
@@ -96,10 +96,10 @@ static int dm_test_bus_children_of_offset(struct unit_test_state *uts)
        ut_assert(node > 0);
        ut_assertok(device_find_child_by_of_offset(bus, node, &dev));
        ut_assertnonnull(dev);
-       ut_assert(!(dev->flags & DM_FLAG_ACTIVATED));
+       ut_assert(!(dev_get_flags(dev) & DM_FLAG_ACTIVATED));
        ut_assertok(device_get_child_by_of_offset(bus, node, &dev));
        ut_assertnonnull(dev);
-       ut_assert(dev->flags & DM_FLAG_ACTIVATED);
+       ut_assert(dev_get_flags(dev) & DM_FLAG_ACTIVATED);
 
        return 0;
 }
index b274b043882b2d4b9a81a45bc4f8a1f0a1fc304d..565896ed504d5742073147d98f008890dcdb72ce 100644 (file)
@@ -131,7 +131,7 @@ static int dm_test_autobind(struct unit_test_state *uts)
 
        /* No devices should be probed */
        list_for_each_entry(dev, &gd->dm_root->child_head, sibling_node)
-               ut_assert(!(dev->flags & DM_FLAG_ACTIVATED));
+               ut_assert(!(dev_get_flags(dev) & DM_FLAG_ACTIVATED));
 
        /* Our test driver should have been bound 3 times */
        ut_assert(dm_testdrv_op_count[DM_TEST_OP_BIND] == 3);
@@ -212,7 +212,7 @@ static int dm_test_autoprobe(struct unit_test_state *uts)
        ut_asserteq(0, dm_testdrv_op_count[DM_TEST_OP_POST_PROBE]);
 
        /* The root device should not be activated until needed */
-       ut_assert(dms->root->flags & DM_FLAG_ACTIVATED);
+       ut_assert(dev_get_flags(dms->root) & DM_FLAG_ACTIVATED);
 
        /*
         * We should be able to find the three test devices, and they should
@@ -222,17 +222,17 @@ static int dm_test_autoprobe(struct unit_test_state *uts)
        for (i = 0; i < 3; i++) {
                ut_assertok(uclass_find_device(UCLASS_TEST, i, &dev));
                ut_assert(dev);
-               ut_assertf(!(dev->flags & DM_FLAG_ACTIVATED),
+               ut_assertf(!(dev_get_flags(dev) & DM_FLAG_ACTIVATED),
                           "Driver %d/%s already activated", i, dev->name);
 
                /* This should activate it */
                ut_assertok(uclass_get_device(UCLASS_TEST, i, &dev));
                ut_assert(dev);
-               ut_assert(dev->flags & DM_FLAG_ACTIVATED);
+               ut_assert(dev_get_flags(dev) & DM_FLAG_ACTIVATED);
 
                /* Activating a device should activate the root device */
                if (!i)
-                       ut_assert(dms->root->flags & DM_FLAG_ACTIVATED);
+                       ut_assert(dev_get_flags(dms->root) & DM_FLAG_ACTIVATED);
        }
 
        /*
@@ -460,10 +460,10 @@ static int dm_test_remove(struct unit_test_state *uts)
        for (i = 0; i < 3; i++) {
                ut_assertok(uclass_find_device(UCLASS_TEST, i, &dev));
                ut_assert(dev);
-               ut_assertf(dev->flags & DM_FLAG_ACTIVATED,
+               ut_assertf(dev_get_flags(dev) & DM_FLAG_ACTIVATED,
                           "Driver %d/%s not activated", i, dev->name);
                ut_assertok(device_remove(dev, DM_REMOVE_NORMAL));
-               ut_assertf(!(dev->flags & DM_FLAG_ACTIVATED),
+               ut_assertf(!(dev_get_flags(dev) & DM_FLAG_ACTIVATED),
                           "Driver %d/%s should have deactivated", i,
                           dev->name);
                ut_assert(!dev_get_priv(dev));
index 28869c1d6ffc560447a22c3839179b5b7c23ca59..ed12cafee2b9cc44b05cfb4d02b4082a56cd1bdd 100644 (file)
@@ -25,7 +25,7 @@ static int dm_test_cpu(struct unit_test_state *uts)
        for (uclass_find_first_device(UCLASS_CPU, &dev);
             dev;
             uclass_find_next_device(&dev))
-               ut_assert(dev->flags & DM_FLAG_ACTIVATED);
+               ut_assert(dev_get_flags(dev) & DM_FLAG_ACTIVATED);
 
        ut_assertok(uclass_get_device_by_name(UCLASS_CPU, "cpu-test1", &dev));
        ut_asserteq_ptr(cpu_get_current_dev(), dev);
index 633256821c2fb1fea822a258a843c1d65af21e61..711bf20a9c53853dd0ed959957fa9f13d8fba32f 100644 (file)
@@ -1031,8 +1031,8 @@ static int dm_test_child_ofdata(struct unit_test_state *uts)
        ut_assertok(uclass_first_device_err(UCLASS_TEST_BUS, &bus));
        count = 0;
        device_foreach_child_of_to_plat(dev, bus) {
-               ut_assert(dev->flags & DM_FLAG_PLATDATA_VALID);
-               ut_assert(!(dev->flags & DM_FLAG_ACTIVATED));
+               ut_assert(dev_get_flags(dev) & DM_FLAG_PLATDATA_VALID);
+               ut_assert(!(dev_get_flags(dev) & DM_FLAG_ACTIVATED));
                count++;
        }
        ut_asserteq(3, count);
@@ -1050,8 +1050,8 @@ static int dm_test_first_child_probe(struct unit_test_state *uts)
        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);
+               ut_assert(dev_get_flags(dev) & DM_FLAG_PLATDATA_VALID);
+               ut_assert(dev_get_flags(dev) & DM_FLAG_ACTIVATED);
                count++;
        }
        ut_asserteq(3, count);
@@ -1067,19 +1067,19 @@ static int dm_test_ofdata_order(struct unit_test_state *uts)
 
        ut_assertok(uclass_find_first_device(UCLASS_I2C, &bus));
        ut_assertnonnull(bus);
-       ut_assert(!(bus->flags & DM_FLAG_PLATDATA_VALID));
+       ut_assert(!(dev_get_flags(bus) & DM_FLAG_PLATDATA_VALID));
 
        ut_assertok(device_find_first_child(bus, &dev));
        ut_assertnonnull(dev);
-       ut_assert(!(dev->flags & DM_FLAG_PLATDATA_VALID));
+       ut_assert(!(dev_get_flags(dev) & DM_FLAG_PLATDATA_VALID));
 
        /* read the child's ofdata which should cause the parent's to be read */
        ut_assertok(device_of_to_plat(dev));
-       ut_assert(dev->flags & DM_FLAG_PLATDATA_VALID);
-       ut_assert(bus->flags & DM_FLAG_PLATDATA_VALID);
+       ut_assert(dev_get_flags(dev) & DM_FLAG_PLATDATA_VALID);
+       ut_assert(dev_get_flags(bus) & DM_FLAG_PLATDATA_VALID);
 
-       ut_assert(!(dev->flags & DM_FLAG_ACTIVATED));
-       ut_assert(!(bus->flags & DM_FLAG_ACTIVATED));
+       ut_assert(!(dev_get_flags(dev) & DM_FLAG_ACTIVATED));
+       ut_assert(!(dev_get_flags(bus) & DM_FLAG_ACTIVATED));
 
        return 0;
 }
index 2e876c36e43f4070e048f1561939af666ccd19ed..ad355981cf41b5ed84b710c4b680c2fe391c05e8 100644 (file)
@@ -122,7 +122,7 @@ static int dm_test_virtio_remove(struct unit_test_state *uts)
        ut_assertok(virtio_set_status(dev, VIRTIO_CONFIG_S_DRIVER_OK));
 
        /* check the device can be successfully removed */
-       dev->flags |= DM_FLAG_ACTIVATED;
+       dev_or_flags(dev, DM_FLAG_ACTIVATED);
        ut_assertok(device_remove(bus, DM_REMOVE_ACTIVE_ALL));
 
        return 0;