hw/imc: Use ARRAY_SIZE instead of static macro

Message ID 1507693204-11244-1-git-send-email-maddy@linux.vnet.ibm.com
State Accepted
Headers show
Series
  • hw/imc: Use ARRAY_SIZE instead of static macro
Related show

Commit Message

Madhavan Srinivasan Oct. 11, 2017, 3:40 a.m.
disable_unavailable_units() loops through nest_pmus array
to filter out the unsupported nest units from the imc
catalog dtb. Current code use a static macro ('MAX_NEST_UNITS')
for array limit, instead use ARRAY_SIZE. This will avoid updates
to static macro when updating the nest_pmus array.

Fixes: 712837cedca06 ('skiboot/imc: Update the nest_pmus array with occ/gpe microcode uav updates')
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
 hw/imc.c      | 2 +-
 include/imc.h | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

Comments

Stewart Smith Oct. 16, 2017, 8:07 a.m. | #1
Madhavan Srinivasan <maddy@linux.vnet.ibm.com> writes:
> disable_unavailable_units() loops through nest_pmus array
> to filter out the unsupported nest units from the imc
> catalog dtb. Current code use a static macro ('MAX_NEST_UNITS')
> for array limit, instead use ARRAY_SIZE. This will avoid updates
> to static macro when updating the nest_pmus array.
>
> Fixes: 712837cedca06 ('skiboot/imc: Update the nest_pmus array with occ/gpe microcode uav updates')
> Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
> ---
>  hw/imc.c      | 2 +-
>  include/imc.h | 2 --
>  2 files changed, 1 insertion(+), 3 deletions(-)

Ahh yep, thanks!

Merged to master as of a9cf7c586871bdd8187760862c2df8bb2fbb2d6f

Patch

diff --git a/hw/imc.c b/hw/imc.c
index 10505f69d4bd..4b2e94884198 100644
--- a/hw/imc.c
+++ b/hw/imc.c
@@ -321,7 +321,7 @@  static void disable_unavailable_units(struct dt_node *dev)
 			avl_vec = (0xffULL) << 56;
 	}
 
-	for (i = 0; i < MAX_NEST_UNITS; i++) {
+	for (i = 0; i < ARRAY_SIZE(nest_pmus); i++) {
 		if (!(PPC_BITMASK(i, i) & avl_vec)) {
 			/* Check if the device node exists */
 			target = dt_find_by_name(dev, nest_pmus[i]);
diff --git a/include/imc.h b/include/imc.h
index 9eaf804ceb50..f3d906ee51c6 100644
--- a/include/imc.h
+++ b/include/imc.h
@@ -119,8 +119,6 @@  struct imc_chip_cb
 #define NEST_IMC_ENABLE			0x1
 #define NEST_IMC_DISABLE		0x2
 
-#define MAX_NEST_UNITS			48
-
 /*
  * Core IMC SCOMs
  */