dm: treewide: Rename auto_alloc_size members to be shorter
This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.
Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index efdb0f2..9953118 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -124,20 +124,20 @@
{
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 79afaf0..5df6112 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -96,21 +96,19 @@
}
}
- 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 @@
}
}
- 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 @@
}
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 @@
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 @@
/* 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 7cc1d46..c244b39 100644
--- a/drivers/core/simple-bus.c
+++ b/drivers/core/simple-bus.c
@@ -47,7 +47,7 @@
.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 51dc9b2..7a18953 100644
--- a/drivers/core/simple-pm-bus.c
+++ b/drivers/core/simple-pm-bus.c
@@ -51,6 +51,6 @@
.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 567d0a4..823d073 100644
--- a/drivers/core/syscon-uclass.c
+++ b/drivers/core/syscon-uclass.c
@@ -174,7 +174,7 @@
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 c3f1b73..b1d882e 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -71,8 +71,8 @@
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 @@
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 @@
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);