summaryrefslogtreecommitdiffstats
path: root/drivers/core/device.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-12-03 16:55:17 -0700
committerSimon Glass <sjg@chromium.org>2020-12-13 08:00:25 -0700
commit41575d8e4c334df148c4cdd7c40cc825dc0fcaa1 (patch)
treec27d9450fb5e72372be8483fc15079467b588169 /drivers/core/device.c
parent78128d52dfca9fff53770c7aed2e4673070c5978 (diff)
downloadu-boot-41575d8e4c334df148c4cdd7c40cc825dc0fcaa1.tar.gz
u-boot-41575d8e4c334df148c4cdd7c40cc825dc0fcaa1.tar.xz
u-boot-41575d8e4c334df148c4cdd7c40cc825dc0fcaa1.zip
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>
Diffstat (limited to 'drivers/core/device.c')
-rw-r--r--drivers/core/device.c26
1 files changed, 11 insertions, 15 deletions
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);