summaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-01-25 08:27:03 -0700
committerSimon Glass <sjg@chromium.org>2015-01-29 17:09:55 -0700
commit0118ce79577f9b0881f99a6e4f8a79cd5014cb87 (patch)
tree4261f26aa29d28709ab619036589c68ecc2f7d03 /drivers/core
parentba8da9dc43ac8ae3351345df12dc7f9d1cd07ae0 (diff)
downloadu-boot-imx-0118ce79577f9b0881f99a6e4f8a79cd5014cb87.zip
u-boot-imx-0118ce79577f9b0881f99a6e4f8a79cd5014cb87.tar.gz
u-boot-imx-0118ce79577f9b0881f99a6e4f8a79cd5014cb87.tar.bz2
dm: core: Add a post_bind method for parents
Allow parent drivers to be called when a new child is bound to them. This allows a bus to set up information it needs for that child. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/device.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c
index 2f33b0e..365676b 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -111,12 +111,24 @@ int device_bind(struct udevice *parent, struct driver *drv, const char *name,
if (ret)
goto fail_bind;
}
+ if (parent && parent->driver->child_post_bind) {
+ ret = parent->driver->child_post_bind(dev);
+ if (ret)
+ goto fail_child_post_bind;
+ }
+
if (parent)
dm_dbg("Bound device %s to %s\n", dev->name, parent->name);
*devp = dev;
return 0;
+fail_child_post_bind:
+ if (drv->unbind && drv->unbind(dev)) {
+ dm_warn("unbind() method failed on dev '%s' on error path\n",
+ dev->name);
+ }
+
fail_bind:
if (uclass_unbind_device(dev)) {
dm_warn("Failed to unbind dev '%s' on error path\n",