diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2015-07-25 21:52:34 +0900 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-08-06 07:44:29 -0600 |
commit | aed1a4dd88e94001b811b297c1ff734c3f8d22d9 (patch) | |
tree | de57a73634e7d1b673be8379d6893eaf62d03ee6 /drivers | |
parent | f33017716e5c430d84366ecc4476ba2b655f3fef (diff) |
dm: add DM_FLAG_BOUND flag
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/core/device-remove.c | 3 | ||||
-rw-r--r-- | drivers/core/device.c | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index 6b87f865e40..45d6543067b 100644 --- a/drivers/core/device-remove.c +++ b/drivers/core/device-remove.c @@ -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); diff --git a/drivers/core/device.c b/drivers/core/device.c index d65717ddc7e..bf6f2716da7 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -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: |