diff options
author | Simon Glass <sjg@chromium.org> | 2015-01-25 08:27:00 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-01-29 17:09:54 -0700 |
commit | f8a85449ef3e0963add728815771ccc09aa99875 (patch) | |
tree | dff087eeb955e883a0e12f597acdc734961bdb4c /drivers/core/device-remove.c | |
parent | 72ebfe86fac2ca0a0e1af9fe1eaa3a634e3e17a1 (diff) |
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.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index 8fc6b71084..2c8257752b 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); |