summaryrefslogtreecommitdiffstats
path: root/drivers/core/device-remove.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-01-25 08:27:06 -0700
committerSimon Glass <sjg@chromium.org>2015-01-29 17:09:55 -0700
commitdac8db2ce66944828e441cccf25703b262a256cd (patch)
tree44a5625d8577254adb38364944372b55ad2549df /drivers/core/device-remove.c
parent9cc36a2b89ebe5148d69d521745c1e1d26365c3a (diff)
downloadtalos-obmc-uboot-dac8db2ce66944828e441cccf25703b262a256cd.tar.gz
talos-obmc-uboot-dac8db2ce66944828e441cccf25703b262a256cd.zip
dm: core: Allow uclasses to specify private data for a device's children
In many cases the per-child private data for a device's children is defined by the uclass rather than the individual driver. For example, a SPI bus needs to store information about each of its children, but all SPI drivers store the same information. It makes sense to allow the uclass to define this data. If the driver provides a size value for its per-child private data, then use it. Failng that, fall back to that provided by the uclass. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Diffstat (limited to 'drivers/core/device-remove.c')
-rw-r--r--drivers/core/device-remove.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index 56c358a0ec..3a5f48df7a 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -126,6 +126,10 @@ void device_free(struct udevice *dev)
}
if (dev->parent) {
size = dev->parent->driver->per_child_auto_alloc_size;
+ if (!size) {
+ size = dev->parent->uclass->uc_drv->
+ per_child_auto_alloc_size;
+ }
if (size) {
free(dev->parent_priv);
dev->parent_priv = NULL;
OpenPOWER on IntegriCloud