[PATCH] arm: mach-k3: *: dev-data: Update to use ARRAY_SIZE

Nishanth Menon nm at ti.com
Thu Jul 13 21:36:34 CEST 2023


Instead of hard-coding the count of entries manually, use ARRAY_SIZE
to keep the count updates appropriately.

Cc: Bryan Brattlof <bb at ti.com>
Suggested-by: Ravi Gunasekaran <r-gunasekaran at ti.com>
Signed-off-by: Nishanth Menon <nm at ti.com>
---

Link to discussion that triggered this:
https://lore.kernel.org/all/20230713185927.3h6vqap4x3h62zd5@bryanbrattlof.com/

 arch/arm/mach-k3/am62ax/dev-data.c | 8 ++++----
 arch/arm/mach-k3/am62x/dev-data.c  | 8 ++++----
 arch/arm/mach-k3/j7200/dev-data.c  | 8 ++++----
 arch/arm/mach-k3/j721e/dev-data.c  | 8 ++++----
 arch/arm/mach-k3/j721s2/dev-data.c | 8 ++++----
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-k3/am62ax/dev-data.c b/arch/arm/mach-k3/am62ax/dev-data.c
index 74739c638524..abf5d8e91aa2 100644
--- a/arch/arm/mach-k3/am62ax/dev-data.c
+++ b/arch/arm/mach-k3/am62ax/dev-data.c
@@ -66,8 +66,8 @@ const struct ti_k3_pd_platdata am62ax_pd_platdata = {
 	.pd = soc_pd_list,
 	.lpsc = soc_lpsc_list,
 	.devs = soc_dev_list,
-	.num_psc = 2,
-	.num_pd = 4,
-	.num_lpsc = 14,
-	.num_devs = 19,
+	.num_psc = ARRAY_SIZE(soc_psc_list),
+	.num_pd = ARRAY_SIZE(soc_pd_list),
+	.num_lpsc = ARRAY_SIZE(soc_lpsc_list),
+	.num_devs = ARRAY_SIZE(soc_dev_list),
 };
diff --git a/arch/arm/mach-k3/am62x/dev-data.c b/arch/arm/mach-k3/am62x/dev-data.c
index 616d0650b9c0..1a6f9e2ca03e 100644
--- a/arch/arm/mach-k3/am62x/dev-data.c
+++ b/arch/arm/mach-k3/am62x/dev-data.c
@@ -71,8 +71,8 @@ const struct ti_k3_pd_platdata am62x_pd_platdata = {
 	.pd = soc_pd_list,
 	.lpsc = soc_lpsc_list,
 	.devs = soc_dev_list,
-	.num_psc = 2,
-	.num_pd = 5,
-	.num_lpsc = 16,
-	.num_devs = 21,
+	.num_psc = ARRAY_SIZE(soc_psc_list),
+	.num_pd = ARRAY_SIZE(soc_pd_list),
+	.num_lpsc = ARRAY_SIZE(soc_lpsc_list),
+	.num_devs = ARRAY_SIZE(soc_dev_list),
 };
diff --git a/arch/arm/mach-k3/j7200/dev-data.c b/arch/arm/mach-k3/j7200/dev-data.c
index c1a4dab6941a..4ddc34210ebb 100644
--- a/arch/arm/mach-k3/j7200/dev-data.c
+++ b/arch/arm/mach-k3/j7200/dev-data.c
@@ -75,8 +75,8 @@ const struct ti_k3_pd_platdata j7200_pd_platdata = {
 	.pd = soc_pd_list,
 	.lpsc = soc_lpsc_list,
 	.devs = soc_dev_list,
-	.num_psc = 2,
-	.num_pd = 6,
-	.num_lpsc = 17,
-	.num_devs = 23,
+	.num_psc = ARRAY_SIZE(soc_psc_list),
+	.num_pd = ARRAY_SIZE(soc_pd_list),
+	.num_lpsc = ARRAY_SIZE(soc_lpsc_list),
+	.num_devs = ARRAY_SIZE(soc_dev_list),
 };
diff --git a/arch/arm/mach-k3/j721e/dev-data.c b/arch/arm/mach-k3/j721e/dev-data.c
index f0afa3552b7f..97f017f8af50 100644
--- a/arch/arm/mach-k3/j721e/dev-data.c
+++ b/arch/arm/mach-k3/j721e/dev-data.c
@@ -73,8 +73,8 @@ const struct ti_k3_pd_platdata j721e_pd_platdata = {
 	.pd = soc_pd_list,
 	.lpsc = soc_lpsc_list,
 	.devs = soc_dev_list,
-	.num_psc = 2,
-	.num_pd = 5,
-	.num_lpsc = 16,
-	.num_devs = 23,
+	.num_psc = ARRAY_SIZE(soc_psc_list),
+	.num_pd = ARRAY_SIZE(soc_pd_list),
+	.num_lpsc = ARRAY_SIZE(soc_lpsc_list),
+	.num_devs = ARRAY_SIZE(soc_dev_list),
 };
diff --git a/arch/arm/mach-k3/j721s2/dev-data.c b/arch/arm/mach-k3/j721s2/dev-data.c
index 35e8b17eb1e7..8c999a3c5a8b 100644
--- a/arch/arm/mach-k3/j721s2/dev-data.c
+++ b/arch/arm/mach-k3/j721s2/dev-data.c
@@ -79,8 +79,8 @@ const struct ti_k3_pd_platdata j721s2_pd_platdata = {
 	.pd = soc_pd_list,
 	.lpsc = soc_lpsc_list,
 	.devs = soc_dev_list,
-	.num_psc = 2,
-	.num_pd = 6,
-	.num_lpsc = 19,
-	.num_devs = 25,
+	.num_psc = ARRAY_SIZE(soc_psc_list),
+	.num_pd = ARRAY_SIZE(soc_pd_list),
+	.num_lpsc = ARRAY_SIZE(soc_lpsc_list),
+	.num_devs = ARRAY_SIZE(soc_dev_list),
 };
-- 
2.40.0



More information about the U-Boot mailing list