summaryrefslogtreecommitdiff
path: root/drivers/core/device-remove.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-01-25 15:27:00 (GMT)
committerSimon Glass <sjg@chromium.org>2015-01-30 00:09:54 (GMT)
commitf8a85449ef3e0963add728815771ccc09aa99875 (patch)
treedff087eeb955e883a0e12f597acdc734961bdb4c /drivers/core/device-remove.c
parent72ebfe86fac2ca0a0e1af9fe1eaa3a634e3e17a1 (diff)
downloadu-boot-f8a85449ef3e0963add728815771ccc09aa99875.tar.xz
dm: core: Allocate platform data when binding a device
When using allocated platform data, allocate it when we bind the device. This makes it possible to fill in this information before the device is probed. This fits with the platform data model (when not using device tree), since platform data exists at bind-time. 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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index 8fc6b71..2c82577 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -88,6 +88,10 @@ int device_unbind(struct udevice *dev)
if (ret)
return ret;
+ if (dev->flags & DM_FLAG_ALLOC_PDATA) {
+ free(dev->platdata);
+ dev->platdata = NULL;
+ }
ret = uclass_unbind_device(dev);
if (ret)
return ret;
@@ -111,10 +115,6 @@ void device_free(struct udevice *dev)
free(dev->priv);
dev->priv = NULL;
}
- if (dev->flags & DM_FLAG_ALLOC_PDATA) {
- free(dev->platdata);
- dev->platdata = NULL;
- }
size = dev->uclass->uc_drv->per_device_auto_alloc_size;
if (size) {
free(dev->uclass_priv);