]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: add DM_FLAG_BOUND flag
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Sat, 25 Jul 2015 12:52:34 +0000 (21:52 +0900)
committerSimon Glass <sjg@chromium.org>
Thu, 6 Aug 2015 13:44:29 +0000 (07:44 -0600)
Currently, we only have DM_FLAG_ACTIVATED to indicate the device
status, but we still cannot know in which stage is in progress,
binding or probing.

This commit introduces a new flag, DM_FLAG_BOUND, which is set when
the device is really bound, and cleared when it is unbound.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
drivers/core/device-remove.c
drivers/core/device.c
include/dm/device.h

index 6b87f865e40377fc1a2e179fa4f4d394d8124abf..45d6543067bcabfd7877bc200dcf6208c2871404 100644 (file)
@@ -61,6 +61,9 @@ int device_unbind(struct udevice *dev)
        if (dev->flags & DM_FLAG_ACTIVATED)
                return -EINVAL;
 
+       if (!(dev->flags & DM_FLAG_BOUND))
+               return -EINVAL;
+
        drv = dev->driver;
        assert(drv);
 
index d65717ddc7e21e4103a041769ba43eebb9202127..bf6f2716da7fe4277fad20fac8e71caa079f42e2 100644 (file)
@@ -132,6 +132,8 @@ int device_bind(struct udevice *parent, const struct driver *drv,
                dm_dbg("Bound device %s to %s\n", dev->name, parent->name);
        *devp = dev;
 
+       dev->flags |= DM_FLAG_BOUND;
+
        return 0;
 
 fail_child_post_bind:
index 12fd02d09a7f3abce5d36638e14167ae1445b878..4cd7ba3386398db88fa5fdbb7f00f18061bd25ef 100644 (file)
@@ -36,6 +36,9 @@ struct driver_info;
 /* Allocate driver private data on a DMA boundary */
 #define DM_FLAG_ALLOC_PRIV_DMA (1 << 5)
 
+/* Device is bound */
+#define DM_FLAG_BOUND  (1 << 6)
+
 /**
  * struct udevice - An instance of a driver
  *