diff options
author | Tom Rini <trini@konsulko.com> | 2021-03-12 15:57:20 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-03-12 15:57:20 -0500 |
commit | c57ec2c2bab00c02a457ca70624c1333c60c2ec0 (patch) | |
tree | 8b8b53585fd9bc655f32eba141f3c2d25d21d882 /drivers/core/device.c | |
parent | 668866aa24a87244e64be42f296959297ddc5014 (diff) | |
parent | fc3283314539d6c3fb577359f6cb364c19c13726 (diff) |
Merge branch '2021-03-12-test-improvements' into next
- Assorted improvements to the pytest framework
Diffstat (limited to 'drivers/core/device.c')
-rw-r--r-- | drivers/core/device.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c index 625134921d..d1098a3861 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -92,15 +92,19 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv, if (auto_seq && !(uc->uc_drv->flags & DM_UC_FLAG_NO_AUTO_SEQ)) dev->seq_ = uclass_find_next_free_seq(uc); + /* Check if we need to allocate plat */ if (drv->plat_auto) { bool alloc = !plat; + /* + * For of-platdata, we try use the existing data, but if + * plat_auto is larger, we must allocate a new space + */ if (CONFIG_IS_ENABLED(OF_PLATDATA)) { - if (of_plat_size) { + if (of_plat_size) dev_or_flags(dev, DM_FLAG_OF_PLATDATA); - if (of_plat_size < drv->plat_auto) - alloc = true; - } + if (of_plat_size < drv->plat_auto) + alloc = true; } if (alloc) { dev_or_flags(dev, DM_FLAG_ALLOC_PDATA); @@ -109,6 +113,11 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv, ret = -ENOMEM; goto fail_alloc1; } + + /* + * For of-platdata, copy the old plat into the new + * space + */ if (CONFIG_IS_ENABLED(OF_PLATDATA) && plat) memcpy(ptr, plat, of_plat_size); dev_set_plat(dev, ptr); |