projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dm: core: Add a post_bind method for parents
[oweals/u-boot.git]
/
drivers
/
core
/
device.c
diff --git
a/drivers/core/device.c
b/drivers/core/device.c
index ee97cc84fff8d83fe77de85efabcd41dde37d362..365676b9121941afb9982013296422ee8b5b77af 100644
(file)
--- a/
drivers/core/device.c
+++ b/
drivers/core/device.c
@@
-83,6
+83,10
@@
int device_bind(struct udevice *parent, struct driver *drv, const char *name,
if (parent) {
int size = parent->driver->per_child_platdata_auto_alloc_size;
if (parent) {
int size = parent->driver->per_child_platdata_auto_alloc_size;
+ if (!size) {
+ size = parent->uclass->uc_drv->
+ per_child_platdata_auto_alloc_size;
+ }
if (size) {
dev->flags |= DM_FLAG_ALLOC_PARENT_PDATA;
dev->parent_platdata = calloc(1, size);
if (size) {
dev->flags |= DM_FLAG_ALLOC_PARENT_PDATA;
dev->parent_platdata = calloc(1, size);
@@
-107,12
+111,24
@@
int device_bind(struct udevice *parent, struct driver *drv, const char *name,
if (ret)
goto fail_bind;
}
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;
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",
fail_bind:
if (uclass_unbind_device(dev)) {
dm_warn("Failed to unbind dev '%s' on error path\n",