diff options
author | Przemyslaw Marczak <p.marczak@samsung.com> | 2015-04-15 14:07:18 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-04-22 20:03:14 +0300 |
commit | 5eaed880282480a5a0a2b555c5f98a11252ed94e (patch) | |
tree | 72f503beff647cf7389f6579add462bf1b5a0727 /drivers/core/device-remove.c | |
parent | c1d6f91952d0761f61b0f0f96e4c7aa32eee2788 (diff) | |
download | u-boot-5eaed880282480a5a0a2b555c5f98a11252ed94e.tar.xz |
dm: core: Extend struct udevice by '.uclass_platdata' field.
This commit adds 'uclass_platdata' field to 'struct udevice', which
can be automatically allocated at bind. The allocation size is defined
in 'struct uclass_driver' as 'per_device_platdata_auto_alloc_size'.
New device's flag is added: DM_FLAG_ALLOC_UCLASS_PDATA, which is used
for memory freeing at device unbind method.
As for other udevice's fields, a complementary function is added:
- dev_get_uclass_platdata()
Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/device-remove.c')
-rw-r--r-- | drivers/core/device-remove.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index 7fee1c001e..6a16b4f690 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_UCLASS_PDATA) { + free(dev->uclass_platdata); + dev->uclass_platdata = NULL; + } if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) { free(dev->parent_platdata); dev->parent_platdata = NULL; |