diff options
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/device-remove.c | 8 | ||||
-rw-r--r-- | drivers/core/device.c | 26 | ||||
-rw-r--r-- | drivers/core/simple-bus.c | 2 | ||||
-rw-r--r-- | drivers/core/simple-pm-bus.c | 2 | ||||
-rw-r--r-- | drivers/core/syscon-uclass.c | 2 | ||||
-rw-r--r-- | drivers/core/uclass.c | 8 |
6 files changed, 22 insertions, 26 deletions
diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index efdb0f2905..9953118ff8 100644 --- a/drivers/core/device-remove.c +++ b/drivers/core/device-remove.c @@ -124,20 +124,20 @@ void device_free(struct udevice *dev) { int size; - if (dev->driver->priv_auto_alloc_size) { + if (dev->driver->priv_auto) { free(dev->priv); dev->priv = NULL; } - size = dev->uclass->uc_drv->per_device_auto_alloc_size; + size = dev->uclass->uc_drv->per_device_auto; if (size) { free(dev->uclass_priv); dev->uclass_priv = NULL; } if (dev->parent) { - size = dev->parent->driver->per_child_auto_alloc_size; + size = dev->parent->driver->per_child_auto; if (!size) { size = dev->parent->uclass->uc_drv-> - per_child_auto_alloc_size; + per_child_auto; } if (size) { free(dev->parent_priv); diff --git a/drivers/core/device.c b/drivers/core/device.c index 79afaf0629..5df61128c6 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -96,21 +96,19 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv, } } - if (drv->platdata_auto_alloc_size) { + if (drv->platdata_auto) { bool alloc = !platdata; if (CONFIG_IS_ENABLED(OF_PLATDATA)) { if (of_platdata_size) { dev->flags |= DM_FLAG_OF_PLATDATA; - if (of_platdata_size < - drv->platdata_auto_alloc_size) + if (of_platdata_size < drv->platdata_auto) alloc = true; } } if (alloc) { dev->flags |= DM_FLAG_ALLOC_PDATA; - dev->platdata = calloc(1, - drv->platdata_auto_alloc_size); + dev->platdata = calloc(1, drv->platdata_auto); if (!dev->platdata) { ret = -ENOMEM; goto fail_alloc1; @@ -122,7 +120,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv, } } - size = uc->uc_drv->per_device_platdata_auto_alloc_size; + size = uc->uc_drv->per_device_platdata_auto; if (size) { dev->flags |= DM_FLAG_ALLOC_UCLASS_PDATA; dev->uclass_platdata = calloc(1, size); @@ -133,10 +131,9 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv, } if (parent) { - size = parent->driver->per_child_platdata_auto_alloc_size; + size = parent->driver->per_child_platdata_auto; if (!size) { - size = parent->uclass->uc_drv-> - per_child_platdata_auto_alloc_size; + size = parent->uclass->uc_drv->per_child_platdata_auto; } if (size) { dev->flags |= DM_FLAG_ALLOC_PARENT_PDATA; @@ -363,15 +360,15 @@ int device_ofdata_to_platdata(struct udevice *dev) assert(drv); /* Allocate private data if requested and not reentered */ - if (drv->priv_auto_alloc_size && !dev->priv) { - dev->priv = alloc_priv(drv->priv_auto_alloc_size, drv->flags); + if (drv->priv_auto && !dev->priv) { + dev->priv = alloc_priv(drv->priv_auto, drv->flags); if (!dev->priv) { ret = -ENOMEM; goto fail; } } /* Allocate private data if requested and not reentered */ - size = dev->uclass->uc_drv->per_device_auto_alloc_size; + size = dev->uclass->uc_drv->per_device_auto; if (size && !dev->uclass_priv) { dev->uclass_priv = alloc_priv(size, dev->uclass->uc_drv->flags); @@ -383,10 +380,9 @@ int device_ofdata_to_platdata(struct udevice *dev) /* Allocate parent data for this child */ if (dev->parent) { - size = dev->parent->driver->per_child_auto_alloc_size; + size = dev->parent->driver->per_child_auto; if (!size) { - size = dev->parent->uclass->uc_drv-> - per_child_auto_alloc_size; + size = dev->parent->uclass->uc_drv->per_child_auto; } if (size && !dev->parent_priv) { dev->parent_priv = alloc_priv(size, drv->flags); diff --git a/drivers/core/simple-bus.c b/drivers/core/simple-bus.c index 7cc1d46009..c244b39345 100644 --- a/drivers/core/simple-bus.c +++ b/drivers/core/simple-bus.c @@ -47,7 +47,7 @@ UCLASS_DRIVER(simple_bus) = { .id = UCLASS_SIMPLE_BUS, .name = "simple_bus", .post_bind = simple_bus_post_bind, - .per_device_platdata_auto_alloc_size = sizeof(struct simple_bus_plat), + .per_device_platdata_auto = sizeof(struct simple_bus_plat), }; static const struct udevice_id generic_simple_bus_ids[] = { diff --git a/drivers/core/simple-pm-bus.c b/drivers/core/simple-pm-bus.c index 51dc9b206f..7a18953cba 100644 --- a/drivers/core/simple-pm-bus.c +++ b/drivers/core/simple-pm-bus.c @@ -51,6 +51,6 @@ U_BOOT_DRIVER(simple_pm_bus_drv) = { .of_match = simple_pm_bus_ids, .probe = simple_pm_bus_probe, .remove = simple_pm_bus_remove, - .priv_auto_alloc_size = sizeof(struct clk_bulk), + .priv_auto = sizeof(struct clk_bulk), .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/core/syscon-uclass.c b/drivers/core/syscon-uclass.c index 567d0a4b50..823d073164 100644 --- a/drivers/core/syscon-uclass.c +++ b/drivers/core/syscon-uclass.c @@ -174,7 +174,7 @@ void *syscon_get_first_range(ulong driver_data) UCLASS_DRIVER(syscon) = { .id = UCLASS_SYSCON, .name = "syscon", - .per_device_auto_alloc_size = sizeof(struct syscon_uc_info), + .per_device_auto = sizeof(struct syscon_uc_info), .pre_probe = syscon_pre_probe, }; diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index c3f1b73cd6..b1d882e14e 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -71,8 +71,8 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp) uc = calloc(1, sizeof(*uc)); if (!uc) return -ENOMEM; - if (uc_drv->priv_auto_alloc_size) { - uc->priv = calloc(1, uc_drv->priv_auto_alloc_size); + if (uc_drv->priv_auto) { + uc->priv = calloc(1, uc_drv->priv_auto); if (!uc->priv) { ret = -ENOMEM; goto fail_mem; @@ -93,7 +93,7 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp) return 0; fail: - if (uc_drv->priv_auto_alloc_size) { + if (uc_drv->priv_auto) { free(uc->priv); uc->priv = NULL; } @@ -131,7 +131,7 @@ int uclass_destroy(struct uclass *uc) if (uc_drv->destroy) uc_drv->destroy(uc); list_del(&uc->sibling_node); - if (uc_drv->priv_auto_alloc_size) + if (uc_drv->priv_auto) free(uc->priv); free(uc); |