dm: Rename 'platdata_size' to 'plat_size'

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2020-12-03 16:55:19 -07:00
parent caa4daa2ae
commit 4f50086ad6
5 changed files with 44 additions and 45 deletions

View file

@ -308,7 +308,7 @@ of-platdata struct to the standard one used by the driver.
In the case where SPL_OF_PLATDATA is enabled, plat_auto is In the case where SPL_OF_PLATDATA is enabled, plat_auto is
still used to allocate space for the platform data. This is different from still used to allocate space for the platform data. This is different from
the normal behaviour and is triggered by the use of of-platdata (strictly the normal behaviour and is triggered by the use of of-platdata (strictly
speaking it is a non-zero platdata_size which triggers this). speaking it is a non-zero plat_size which triggers this).
The of-platdata struct contents is copied from the C structure data to the The of-platdata struct contents is copied from the C structure data to the
start of the newly allocated area. In the case where device tree is used, start of the newly allocated area. In the case where device tree is used,

View file

@ -36,7 +36,7 @@ DECLARE_GLOBAL_DATA_PTR;
static int device_bind_common(struct udevice *parent, const struct driver *drv, static int device_bind_common(struct udevice *parent, const struct driver *drv,
const char *name, void *plat, const char *name, void *plat,
ulong driver_data, ofnode node, ulong driver_data, ofnode node,
uint of_platdata_size, struct udevice **devp) uint of_plat_size, struct udevice **devp)
{ {
struct udevice *dev; struct udevice *dev;
struct uclass *uc; struct uclass *uc;
@ -100,9 +100,9 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
bool alloc = !plat; bool alloc = !plat;
if (CONFIG_IS_ENABLED(OF_PLATDATA)) { if (CONFIG_IS_ENABLED(OF_PLATDATA)) {
if (of_platdata_size) { if (of_plat_size) {
dev->flags |= DM_FLAG_OF_PLATDATA; dev->flags |= DM_FLAG_OF_PLATDATA;
if (of_platdata_size < drv->plat_auto) if (of_plat_size < drv->plat_auto)
alloc = true; alloc = true;
} }
} }
@ -114,8 +114,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
goto fail_alloc1; goto fail_alloc1;
} }
if (CONFIG_IS_ENABLED(OF_PLATDATA) && plat) { if (CONFIG_IS_ENABLED(OF_PLATDATA) && plat) {
memcpy(dev->plat, plat, memcpy(dev->plat, plat, of_plat_size);
of_platdata_size);
} }
} }
} }
@ -241,7 +240,7 @@ int device_bind_by_name(struct udevice *parent, bool pre_reloc_only,
const struct driver_info *info, struct udevice **devp) const struct driver_info *info, struct udevice **devp)
{ {
struct driver *drv; struct driver *drv;
uint platdata_size = 0; uint plat_size = 0;
int ret; int ret;
drv = lists_driver_lookup_name(info->name); drv = lists_driver_lookup_name(info->name);
@ -251,10 +250,10 @@ int device_bind_by_name(struct udevice *parent, bool pre_reloc_only,
return -EPERM; return -EPERM;
#if CONFIG_IS_ENABLED(OF_PLATDATA) #if CONFIG_IS_ENABLED(OF_PLATDATA)
platdata_size = info->platdata_size; plat_size = info->plat_size;
#endif #endif
ret = device_bind_common(parent, drv, info->name, (void *)info->plat, 0, ret = device_bind_common(parent, drv, info->name, (void *)info->plat, 0,
ofnode_null(), platdata_size, devp); ofnode_null(), plat_size, devp);
if (ret) if (ret)
return ret; return ret;

View file

@ -21,14 +21,14 @@
* *
* @name: Driver name * @name: Driver name
* @plat: Driver-specific platform data * @plat: Driver-specific platform data
* @platdata_size: Size of platform data structure * @plat_size: Size of platform data structure
* @parent_idx: Index of the parent driver_info structure * @parent_idx: Index of the parent driver_info structure
*/ */
struct driver_info { struct driver_info {
const char *name; const char *name;
const void *plat; const void *plat;
#if CONFIG_IS_ENABLED(OF_PLATDATA) #if CONFIG_IS_ENABLED(OF_PLATDATA)
unsigned short platdata_size; unsigned short plat_size;
short parent_idx; short parent_idx;
#endif #endif
}; };

View file

@ -660,7 +660,7 @@ class DtbPlatdata(object):
self.buf('U_BOOT_DEVICE(%s) = {\n' % var_name) self.buf('U_BOOT_DEVICE(%s) = {\n' % var_name)
self.buf('\t.name\t\t= "%s",\n' % struct_name) self.buf('\t.name\t\t= "%s",\n' % struct_name)
self.buf('\t.plat\t= &%s%s,\n' % (VAL_PREFIX, var_name)) self.buf('\t.plat\t= &%s%s,\n' % (VAL_PREFIX, var_name))
self.buf('\t.platdata_size\t= sizeof(%s%s),\n' % (VAL_PREFIX, var_name)) self.buf('\t.plat_size\t= sizeof(%s%s),\n' % (VAL_PREFIX, var_name))
idx = -1 idx = -1
if node.parent and node.parent in self._valid_nodes: if node.parent and node.parent in self._valid_nodes:
idx = node.parent.idx idx = node.parent.idx

View file

@ -218,7 +218,7 @@ static struct dtd_sandbox_i2c_test dtv_i2c_at_0 = {
U_BOOT_DEVICE(i2c_at_0) = { U_BOOT_DEVICE(i2c_at_0) = {
\t.name\t\t= "sandbox_i2c_test", \t.name\t\t= "sandbox_i2c_test",
\t.plat\t= &dtv_i2c_at_0, \t.plat\t= &dtv_i2c_at_0,
\t.platdata_size\t= sizeof(dtv_i2c_at_0), \t.plat_size\t= sizeof(dtv_i2c_at_0),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -230,7 +230,7 @@ static struct dtd_sandbox_pmic_test dtv_pmic_at_9 = {
U_BOOT_DEVICE(pmic_at_9) = { U_BOOT_DEVICE(pmic_at_9) = {
\t.name\t\t= "sandbox_pmic_test", \t.name\t\t= "sandbox_pmic_test",
\t.plat\t= &dtv_pmic_at_9, \t.plat\t= &dtv_pmic_at_9,
\t.platdata_size\t= sizeof(dtv_pmic_at_9), \t.plat_size\t= sizeof(dtv_pmic_at_9),
\t.parent_idx\t= 0, \t.parent_idx\t= 0,
}; };
@ -250,7 +250,7 @@ static struct dtd_sandbox_spl_test dtv_spl_test = {
U_BOOT_DEVICE(spl_test) = { U_BOOT_DEVICE(spl_test) = {
\t.name\t\t= "sandbox_spl_test", \t.name\t\t= "sandbox_spl_test",
\t.plat\t= &dtv_spl_test, \t.plat\t= &dtv_spl_test,
\t.platdata_size\t= sizeof(dtv_spl_test), \t.plat_size\t= sizeof(dtv_spl_test),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -269,7 +269,7 @@ static struct dtd_sandbox_spl_test dtv_spl_test2 = {
U_BOOT_DEVICE(spl_test2) = { U_BOOT_DEVICE(spl_test2) = {
\t.name\t\t= "sandbox_spl_test", \t.name\t\t= "sandbox_spl_test",
\t.plat\t= &dtv_spl_test2, \t.plat\t= &dtv_spl_test2,
\t.platdata_size\t= sizeof(dtv_spl_test2), \t.plat_size\t= sizeof(dtv_spl_test2),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -282,7 +282,7 @@ static struct dtd_sandbox_spl_test dtv_spl_test3 = {
U_BOOT_DEVICE(spl_test3) = { U_BOOT_DEVICE(spl_test3) = {
\t.name\t\t= "sandbox_spl_test", \t.name\t\t= "sandbox_spl_test",
\t.plat\t= &dtv_spl_test3, \t.plat\t= &dtv_spl_test3,
\t.platdata_size\t= sizeof(dtv_spl_test3), \t.plat_size\t= sizeof(dtv_spl_test3),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -292,7 +292,7 @@ static struct dtd_sandbox_spl_test_2 dtv_spl_test4 = {
U_BOOT_DEVICE(spl_test4) = { U_BOOT_DEVICE(spl_test4) = {
\t.name\t\t= "sandbox_spl_test_2", \t.name\t\t= "sandbox_spl_test_2",
\t.plat\t= &dtv_spl_test4, \t.plat\t= &dtv_spl_test4,
\t.platdata_size\t= sizeof(dtv_spl_test4), \t.plat_size\t= sizeof(dtv_spl_test4),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -326,7 +326,7 @@ static struct dtd_sandbox_gpio dtv_gpios_at_0 = {
U_BOOT_DEVICE(gpios_at_0) = { U_BOOT_DEVICE(gpios_at_0) = {
\t.name\t\t= "sandbox_gpio", \t.name\t\t= "sandbox_gpio",
\t.plat\t= &dtv_gpios_at_0, \t.plat\t= &dtv_gpios_at_0,
\t.platdata_size\t= sizeof(dtv_gpios_at_0), \t.plat_size\t= sizeof(dtv_gpios_at_0),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -358,7 +358,7 @@ static struct dtd_invalid dtv_spl_test = {
U_BOOT_DEVICE(spl_test) = { U_BOOT_DEVICE(spl_test) = {
\t.name\t\t= "invalid", \t.name\t\t= "invalid",
\t.plat\t= &dtv_spl_test, \t.plat\t= &dtv_spl_test,
\t.platdata_size\t= sizeof(dtv_spl_test), \t.plat_size\t= sizeof(dtv_spl_test),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -393,7 +393,7 @@ static struct dtd_target dtv_phandle2_target = {
U_BOOT_DEVICE(phandle2_target) = { U_BOOT_DEVICE(phandle2_target) = {
\t.name\t\t= "target", \t.name\t\t= "target",
\t.plat\t= &dtv_phandle2_target, \t.plat\t= &dtv_phandle2_target,
\t.platdata_size\t= sizeof(dtv_phandle2_target), \t.plat_size\t= sizeof(dtv_phandle2_target),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -404,7 +404,7 @@ static struct dtd_target dtv_phandle3_target = {
U_BOOT_DEVICE(phandle3_target) = { U_BOOT_DEVICE(phandle3_target) = {
\t.name\t\t= "target", \t.name\t\t= "target",
\t.plat\t= &dtv_phandle3_target, \t.plat\t= &dtv_phandle3_target,
\t.platdata_size\t= sizeof(dtv_phandle3_target), \t.plat_size\t= sizeof(dtv_phandle3_target),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -415,7 +415,7 @@ static struct dtd_target dtv_phandle_target = {
U_BOOT_DEVICE(phandle_target) = { U_BOOT_DEVICE(phandle_target) = {
\t.name\t\t= "target", \t.name\t\t= "target",
\t.plat\t= &dtv_phandle_target, \t.plat\t= &dtv_phandle_target,
\t.platdata_size\t= sizeof(dtv_phandle_target), \t.plat_size\t= sizeof(dtv_phandle_target),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -430,7 +430,7 @@ static struct dtd_source dtv_phandle_source = {
U_BOOT_DEVICE(phandle_source) = { U_BOOT_DEVICE(phandle_source) = {
\t.name\t\t= "source", \t.name\t\t= "source",
\t.plat\t= &dtv_phandle_source, \t.plat\t= &dtv_phandle_source,
\t.platdata_size\t= sizeof(dtv_phandle_source), \t.plat_size\t= sizeof(dtv_phandle_source),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -442,7 +442,7 @@ static struct dtd_source dtv_phandle_source2 = {
U_BOOT_DEVICE(phandle_source2) = { U_BOOT_DEVICE(phandle_source2) = {
\t.name\t\t= "source", \t.name\t\t= "source",
\t.plat\t= &dtv_phandle_source2, \t.plat\t= &dtv_phandle_source2,
\t.platdata_size\t= sizeof(dtv_phandle_source2), \t.plat_size\t= sizeof(dtv_phandle_source2),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -480,7 +480,7 @@ static struct dtd_target dtv_phandle_target = {
U_BOOT_DEVICE(phandle_target) = { U_BOOT_DEVICE(phandle_target) = {
\t.name\t\t= "target", \t.name\t\t= "target",
\t.plat\t= &dtv_phandle_target, \t.plat\t= &dtv_phandle_target,
\t.platdata_size\t= sizeof(dtv_phandle_target), \t.plat_size\t= sizeof(dtv_phandle_target),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -492,7 +492,7 @@ static struct dtd_source dtv_phandle_source2 = {
U_BOOT_DEVICE(phandle_source2) = { U_BOOT_DEVICE(phandle_source2) = {
\t.name\t\t= "source", \t.name\t\t= "source",
\t.plat\t= &dtv_phandle_source2, \t.plat\t= &dtv_phandle_source2,
\t.platdata_size\t= sizeof(dtv_phandle_source2), \t.plat_size\t= sizeof(dtv_phandle_source2),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -515,7 +515,7 @@ static struct dtd_target dtv_phandle2_target = {
U_BOOT_DEVICE(phandle2_target) = { U_BOOT_DEVICE(phandle2_target) = {
\t.name\t\t= "target", \t.name\t\t= "target",
\t.plat\t= &dtv_phandle2_target, \t.plat\t= &dtv_phandle2_target,
\t.platdata_size\t= sizeof(dtv_phandle2_target), \t.plat_size\t= sizeof(dtv_phandle2_target),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -526,7 +526,7 @@ static struct dtd_target dtv_phandle3_target = {
U_BOOT_DEVICE(phandle3_target) = { U_BOOT_DEVICE(phandle3_target) = {
\t.name\t\t= "target", \t.name\t\t= "target",
\t.plat\t= &dtv_phandle3_target, \t.plat\t= &dtv_phandle3_target,
\t.platdata_size\t= sizeof(dtv_phandle3_target), \t.plat_size\t= sizeof(dtv_phandle3_target),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -537,7 +537,7 @@ static struct dtd_target dtv_phandle_target = {
U_BOOT_DEVICE(phandle_target) = { U_BOOT_DEVICE(phandle_target) = {
\t.name\t\t= "target", \t.name\t\t= "target",
\t.plat\t= &dtv_phandle_target, \t.plat\t= &dtv_phandle_target,
\t.platdata_size\t= sizeof(dtv_phandle_target), \t.plat_size\t= sizeof(dtv_phandle_target),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -552,7 +552,7 @@ static struct dtd_source dtv_phandle_source = {
U_BOOT_DEVICE(phandle_source) = { U_BOOT_DEVICE(phandle_source) = {
\t.name\t\t= "source", \t.name\t\t= "source",
\t.plat\t= &dtv_phandle_source, \t.plat\t= &dtv_phandle_source,
\t.platdata_size\t= sizeof(dtv_phandle_source), \t.plat_size\t= sizeof(dtv_phandle_source),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -564,7 +564,7 @@ static struct dtd_source dtv_phandle_source2 = {
U_BOOT_DEVICE(phandle_source2) = { U_BOOT_DEVICE(phandle_source2) = {
\t.name\t\t= "source", \t.name\t\t= "source",
\t.plat\t= &dtv_phandle_source2, \t.plat\t= &dtv_phandle_source2,
\t.platdata_size\t= sizeof(dtv_phandle_source2), \t.plat_size\t= sizeof(dtv_phandle_source2),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -622,7 +622,7 @@ static struct dtd_test1 dtv_test1 = {
U_BOOT_DEVICE(test1) = { U_BOOT_DEVICE(test1) = {
\t.name\t\t= "test1", \t.name\t\t= "test1",
\t.plat\t= &dtv_test1, \t.plat\t= &dtv_test1,
\t.platdata_size\t= sizeof(dtv_test1), \t.plat_size\t= sizeof(dtv_test1),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -633,7 +633,7 @@ static struct dtd_test2 dtv_test2 = {
U_BOOT_DEVICE(test2) = { U_BOOT_DEVICE(test2) = {
\t.name\t\t= "test2", \t.name\t\t= "test2",
\t.plat\t= &dtv_test2, \t.plat\t= &dtv_test2,
\t.platdata_size\t= sizeof(dtv_test2), \t.plat_size\t= sizeof(dtv_test2),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -644,7 +644,7 @@ static struct dtd_test3 dtv_test3 = {
U_BOOT_DEVICE(test3) = { U_BOOT_DEVICE(test3) = {
\t.name\t\t= "test3", \t.name\t\t= "test3",
\t.plat\t= &dtv_test3, \t.plat\t= &dtv_test3,
\t.platdata_size\t= sizeof(dtv_test3), \t.plat_size\t= sizeof(dtv_test3),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -677,7 +677,7 @@ static struct dtd_test1 dtv_test1 = {
U_BOOT_DEVICE(test1) = { U_BOOT_DEVICE(test1) = {
\t.name\t\t= "test1", \t.name\t\t= "test1",
\t.plat\t= &dtv_test1, \t.plat\t= &dtv_test1,
\t.platdata_size\t= sizeof(dtv_test1), \t.plat_size\t= sizeof(dtv_test1),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -688,7 +688,7 @@ static struct dtd_test2 dtv_test2 = {
U_BOOT_DEVICE(test2) = { U_BOOT_DEVICE(test2) = {
\t.name\t\t= "test2", \t.name\t\t= "test2",
\t.plat\t= &dtv_test2, \t.plat\t= &dtv_test2,
\t.platdata_size\t= sizeof(dtv_test2), \t.plat_size\t= sizeof(dtv_test2),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -724,7 +724,7 @@ static struct dtd_test1 dtv_test1 = {
U_BOOT_DEVICE(test1) = { U_BOOT_DEVICE(test1) = {
\t.name\t\t= "test1", \t.name\t\t= "test1",
\t.plat\t= &dtv_test1, \t.plat\t= &dtv_test1,
\t.platdata_size\t= sizeof(dtv_test1), \t.plat_size\t= sizeof(dtv_test1),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -735,7 +735,7 @@ static struct dtd_test2 dtv_test2 = {
U_BOOT_DEVICE(test2) = { U_BOOT_DEVICE(test2) = {
\t.name\t\t= "test2", \t.name\t\t= "test2",
\t.plat\t= &dtv_test2, \t.plat\t= &dtv_test2,
\t.platdata_size\t= sizeof(dtv_test2), \t.plat_size\t= sizeof(dtv_test2),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -746,7 +746,7 @@ static struct dtd_test3 dtv_test3 = {
U_BOOT_DEVICE(test3) = { U_BOOT_DEVICE(test3) = {
\t.name\t\t= "test3", \t.name\t\t= "test3",
\t.plat\t= &dtv_test3, \t.plat\t= &dtv_test3,
\t.platdata_size\t= sizeof(dtv_test3), \t.plat_size\t= sizeof(dtv_test3),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -782,7 +782,7 @@ static struct dtd_test1 dtv_test1 = {
U_BOOT_DEVICE(test1) = { U_BOOT_DEVICE(test1) = {
\t.name\t\t= "test1", \t.name\t\t= "test1",
\t.plat\t= &dtv_test1, \t.plat\t= &dtv_test1,
\t.platdata_size\t= sizeof(dtv_test1), \t.plat_size\t= sizeof(dtv_test1),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -793,7 +793,7 @@ static struct dtd_test2 dtv_test2 = {
U_BOOT_DEVICE(test2) = { U_BOOT_DEVICE(test2) = {
\t.name\t\t= "test2", \t.name\t\t= "test2",
\t.plat\t= &dtv_test2, \t.plat\t= &dtv_test2,
\t.platdata_size\t= sizeof(dtv_test2), \t.plat_size\t= sizeof(dtv_test2),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -804,7 +804,7 @@ static struct dtd_test3 dtv_test3 = {
U_BOOT_DEVICE(test3) = { U_BOOT_DEVICE(test3) = {
\t.name\t\t= "test3", \t.name\t\t= "test3",
\t.plat\t= &dtv_test3, \t.plat\t= &dtv_test3,
\t.platdata_size\t= sizeof(dtv_test3), \t.plat_size\t= sizeof(dtv_test3),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -855,7 +855,7 @@ static struct dtd_sandbox_spl_test dtv_spl_test = {
U_BOOT_DEVICE(spl_test) = { U_BOOT_DEVICE(spl_test) = {
\t.name\t\t= "sandbox_spl_test", \t.name\t\t= "sandbox_spl_test",
\t.plat\t= &dtv_spl_test, \t.plat\t= &dtv_spl_test,
\t.platdata_size\t= sizeof(dtv_spl_test), \t.plat_size\t= sizeof(dtv_spl_test),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };
@ -866,7 +866,7 @@ static struct dtd_sandbox_spl_test dtv_spl_test2 = {
U_BOOT_DEVICE(spl_test2) = { U_BOOT_DEVICE(spl_test2) = {
\t.name\t\t= "sandbox_spl_test", \t.name\t\t= "sandbox_spl_test",
\t.plat\t= &dtv_spl_test2, \t.plat\t= &dtv_spl_test2,
\t.platdata_size\t= sizeof(dtv_spl_test2), \t.plat_size\t= sizeof(dtv_spl_test2),
\t.parent_idx\t= -1, \t.parent_idx\t= -1,
}; };