[PATCH 4/9] dm: Rename 'platdata_size' to 'plat_size'

Simon Glass sjg at chromium.org
Fri Dec 4 00:55:19 CET 2020


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

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 doc/driver-model/of-plat.rst |  2 +-
 drivers/core/device.c        | 15 ++++----
 include/dm/platdata.h        |  4 +--
 tools/dtoc/dtb_platdata.py   |  2 +-
 tools/dtoc/test_dtoc.py      | 66 ++++++++++++++++++------------------
 5 files changed, 44 insertions(+), 45 deletions(-)

diff --git a/doc/driver-model/of-plat.rst b/doc/driver-model/of-plat.rst
index a05faf739fd..8c2bfb4099c 100644
--- a/doc/driver-model/of-plat.rst
+++ b/doc/driver-model/of-plat.rst
@@ -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
 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
-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
 start of the newly allocated area. In the case where device tree is used,
diff --git a/drivers/core/device.c b/drivers/core/device.c
index a91d7237d4d..5f6f99770d4 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -36,7 +36,7 @@ DECLARE_GLOBAL_DATA_PTR;
 static int device_bind_common(struct udevice *parent, const struct driver *drv,
 			      const char *name, void *plat,
 			      ulong driver_data, ofnode node,
-			      uint of_platdata_size, struct udevice **devp)
+			      uint of_plat_size, struct udevice **devp)
 {
 	struct udevice *dev;
 	struct uclass *uc;
@@ -98,9 +98,9 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
 		bool alloc = !plat;
 
 		if (CONFIG_IS_ENABLED(OF_PLATDATA)) {
-			if (of_platdata_size) {
+			if (of_plat_size) {
 				dev->flags |= DM_FLAG_OF_PLATDATA;
-				if (of_platdata_size < drv->plat_auto)
+				if (of_plat_size < drv->plat_auto)
 					alloc = true;
 			}
 		}
@@ -112,8 +112,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
 				goto fail_alloc1;
 			}
 			if (CONFIG_IS_ENABLED(OF_PLATDATA) && plat) {
-				memcpy(dev->plat, plat,
-				       of_platdata_size);
+				memcpy(dev->plat, plat, of_plat_size);
 			}
 		}
 	}
@@ -239,7 +238,7 @@ int device_bind_by_name(struct udevice *parent, bool pre_reloc_only,
 			const struct driver_info *info, struct udevice **devp)
 {
 	struct driver *drv;
-	uint platdata_size = 0;
+	uint plat_size = 0;
 	int ret;
 
 	drv = lists_driver_lookup_name(info->name);
@@ -249,10 +248,10 @@ int device_bind_by_name(struct udevice *parent, bool pre_reloc_only,
 		return -EPERM;
 
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
-	platdata_size = info->platdata_size;
+	plat_size = info->plat_size;
 #endif
 	ret = device_bind_common(parent, drv, info->name, (void *)info->plat, 0,
-				 ofnode_null(), platdata_size, devp);
+				 ofnode_null(), plat_size, devp);
 	if (ret)
 		return ret;
 
diff --git a/include/dm/platdata.h b/include/dm/platdata.h
index 6094b663f8b..d650fb39190 100644
--- a/include/dm/platdata.h
+++ b/include/dm/platdata.h
@@ -21,14 +21,14 @@
  *
  * @name:	Driver name
  * @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
  */
 struct driver_info {
 	const char *name;
 	const void *plat;
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
-	unsigned short platdata_size;
+	unsigned short plat_size;
 	short parent_idx;
 #endif
 };
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
index 2f3413cf20c..82671138a9a 100644
--- a/tools/dtoc/dtb_platdata.py
+++ b/tools/dtoc/dtb_platdata.py
@@ -660,7 +660,7 @@ class DtbPlatdata(object):
         self.buf('U_BOOT_DEVICE(%s) = {\n' % var_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.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
         if node.parent and node.parent in self._valid_nodes:
             idx = node.parent.idx
diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py
index 6992a66c884..4913d950218 100755
--- a/tools/dtoc/test_dtoc.py
+++ b/tools/dtoc/test_dtoc.py
@@ -218,7 +218,7 @@ static struct dtd_sandbox_i2c_test dtv_i2c_at_0 = {
 U_BOOT_DEVICE(i2c_at_0) = {
 \t.name\t\t= "sandbox_i2c_test",
 \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,
 };
 
@@ -230,7 +230,7 @@ static struct dtd_sandbox_pmic_test dtv_pmic_at_9 = {
 U_BOOT_DEVICE(pmic_at_9) = {
 \t.name\t\t= "sandbox_pmic_test",
 \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,
 };
 
@@ -250,7 +250,7 @@ static struct dtd_sandbox_spl_test dtv_spl_test = {
 U_BOOT_DEVICE(spl_test) = {
 \t.name\t\t= "sandbox_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,
 };
 
@@ -269,7 +269,7 @@ static struct dtd_sandbox_spl_test dtv_spl_test2 = {
 U_BOOT_DEVICE(spl_test2) = {
 \t.name\t\t= "sandbox_spl_test",
 \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,
 };
 
@@ -282,7 +282,7 @@ static struct dtd_sandbox_spl_test dtv_spl_test3 = {
 U_BOOT_DEVICE(spl_test3) = {
 \t.name\t\t= "sandbox_spl_test",
 \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,
 };
 
@@ -292,7 +292,7 @@ static struct dtd_sandbox_spl_test_2 dtv_spl_test4 = {
 U_BOOT_DEVICE(spl_test4) = {
 \t.name\t\t= "sandbox_spl_test_2",
 \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,
 };
 
@@ -326,7 +326,7 @@ static struct dtd_sandbox_gpio dtv_gpios_at_0 = {
 U_BOOT_DEVICE(gpios_at_0) = {
 \t.name\t\t= "sandbox_gpio",
 \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,
 };
 
@@ -358,7 +358,7 @@ static struct dtd_invalid dtv_spl_test = {
 U_BOOT_DEVICE(spl_test) = {
 \t.name\t\t= "invalid",
 \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,
 };
 
@@ -393,7 +393,7 @@ static struct dtd_target dtv_phandle2_target = {
 U_BOOT_DEVICE(phandle2_target) = {
 \t.name\t\t= "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,
 };
 
@@ -404,7 +404,7 @@ static struct dtd_target dtv_phandle3_target = {
 U_BOOT_DEVICE(phandle3_target) = {
 \t.name\t\t= "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,
 };
 
@@ -415,7 +415,7 @@ static struct dtd_target dtv_phandle_target = {
 U_BOOT_DEVICE(phandle_target) = {
 \t.name\t\t= "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,
 };
 
@@ -430,7 +430,7 @@ static struct dtd_source dtv_phandle_source = {
 U_BOOT_DEVICE(phandle_source) = {
 \t.name\t\t= "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,
 };
 
@@ -442,7 +442,7 @@ static struct dtd_source dtv_phandle_source2 = {
 U_BOOT_DEVICE(phandle_source2) = {
 \t.name\t\t= "source",
 \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,
 };
 
@@ -480,7 +480,7 @@ static struct dtd_target dtv_phandle_target = {
 U_BOOT_DEVICE(phandle_target) = {
 \t.name\t\t= "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,
 };
 
@@ -492,7 +492,7 @@ static struct dtd_source dtv_phandle_source2 = {
 U_BOOT_DEVICE(phandle_source2) = {
 \t.name\t\t= "source",
 \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,
 };
 
@@ -515,7 +515,7 @@ static struct dtd_target dtv_phandle2_target = {
 U_BOOT_DEVICE(phandle2_target) = {
 \t.name\t\t= "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,
 };
 
@@ -526,7 +526,7 @@ static struct dtd_target dtv_phandle3_target = {
 U_BOOT_DEVICE(phandle3_target) = {
 \t.name\t\t= "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,
 };
 
@@ -537,7 +537,7 @@ static struct dtd_target dtv_phandle_target = {
 U_BOOT_DEVICE(phandle_target) = {
 \t.name\t\t= "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,
 };
 
@@ -552,7 +552,7 @@ static struct dtd_source dtv_phandle_source = {
 U_BOOT_DEVICE(phandle_source) = {
 \t.name\t\t= "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,
 };
 
@@ -564,7 +564,7 @@ static struct dtd_source dtv_phandle_source2 = {
 U_BOOT_DEVICE(phandle_source2) = {
 \t.name\t\t= "source",
 \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,
 };
 
@@ -622,7 +622,7 @@ static struct dtd_test1 dtv_test1 = {
 U_BOOT_DEVICE(test1) = {
 \t.name\t\t= "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,
 };
 
@@ -633,7 +633,7 @@ static struct dtd_test2 dtv_test2 = {
 U_BOOT_DEVICE(test2) = {
 \t.name\t\t= "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,
 };
 
@@ -644,7 +644,7 @@ static struct dtd_test3 dtv_test3 = {
 U_BOOT_DEVICE(test3) = {
 \t.name\t\t= "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,
 };
 
@@ -677,7 +677,7 @@ static struct dtd_test1 dtv_test1 = {
 U_BOOT_DEVICE(test1) = {
 \t.name\t\t= "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,
 };
 
@@ -688,7 +688,7 @@ static struct dtd_test2 dtv_test2 = {
 U_BOOT_DEVICE(test2) = {
 \t.name\t\t= "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,
 };
 
@@ -724,7 +724,7 @@ static struct dtd_test1 dtv_test1 = {
 U_BOOT_DEVICE(test1) = {
 \t.name\t\t= "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,
 };
 
@@ -735,7 +735,7 @@ static struct dtd_test2 dtv_test2 = {
 U_BOOT_DEVICE(test2) = {
 \t.name\t\t= "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,
 };
 
@@ -746,7 +746,7 @@ static struct dtd_test3 dtv_test3 = {
 U_BOOT_DEVICE(test3) = {
 \t.name\t\t= "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,
 };
 
@@ -782,7 +782,7 @@ static struct dtd_test1 dtv_test1 = {
 U_BOOT_DEVICE(test1) = {
 \t.name\t\t= "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,
 };
 
@@ -793,7 +793,7 @@ static struct dtd_test2 dtv_test2 = {
 U_BOOT_DEVICE(test2) = {
 \t.name\t\t= "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,
 };
 
@@ -804,7 +804,7 @@ static struct dtd_test3 dtv_test3 = {
 U_BOOT_DEVICE(test3) = {
 \t.name\t\t= "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,
 };
 
@@ -855,7 +855,7 @@ static struct dtd_sandbox_spl_test dtv_spl_test = {
 U_BOOT_DEVICE(spl_test) = {
 \t.name\t\t= "sandbox_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,
 };
 
@@ -866,7 +866,7 @@ static struct dtd_sandbox_spl_test dtv_spl_test2 = {
 U_BOOT_DEVICE(spl_test2) = {
 \t.name\t\t= "sandbox_spl_test",
 \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,
 };
 
-- 
2.29.2.576.ga3fc446d84-goog



More information about the U-Boot mailing list