summaryrefslogtreecommitdiff
path: root/drivers/core/device-remove.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-01-25 08:27:01 -0700
committerSimon Glass <sjg@chromium.org>2015-01-29 17:09:54 -0700
commitcdc133bde9dd221319b9cf7fd99fcb4da8ba195c (patch)
treedaef0d65d0107aa4b93d3611f217947a6cf502e8 /drivers/core/device-remove.c
parentf8a85449ef3e0963add728815771ccc09aa99875 (diff)
dm: core: Allow parents to have platform data for their children
For buses it is common for parents to need to know the address of the child on the bus, the bus speed to use for that child, and other information. This can be provided in platform data attached to each child. Add driver model support for this, including auto-allocation which can be requested using a new property to specify the size of the data. 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 2c8257752b..56c358a0ec 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -92,6 +92,10 @@ int device_unbind(struct udevice *dev)
free(dev->platdata);
dev->platdata = NULL;
}
+ if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) {
+ free(dev->parent_platdata);
+ dev->parent_platdata = NULL;
+ }
ret = uclass_unbind_device(dev);
if (ret)
return ret;