Skip to contentSkip to conversation

igb: Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0])

PATCH Maninder Singh 1 participant 1 message Jun 30, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Joe,

Quoted 4 lines
Quoted 1 line

Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0])

I think all of these #defines should be removed instead as they are all used only once.

If we replcase only ARRAY_SIZE then cood will look alike to drivers/net/ethernet/intel/e1000e/phy.c

And if we have to remove these #defines , then we can also remove it from drivers/net/ethernet/intel/e1000e/phy.c

Because same operations and same usage is there in both files. what say?

Quoted 10 lines

drivers/net/ethernet/intel/igb/e1000_phy.c

Quoted 1 line
drivers/net/ethernet/intel/igb/e1000_phy.c +0 -0

[]

Quoted 8 lines
drivers/net/ethernet/intel/igb/e1000_phy.c +1 -2
@@ -37,8 +37,7 @@ static s32  igb_set_master_slave_mode(struct e1000_hw *hw);
 static const u16 e1000_m88_cable_length_table[] = {
 	0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED };
 #define M88E1000_CABLE_LENGTH_TABLE_SIZE \
-	(sizeof(e1000_m88_cable_length_table) / \
-	sizeof(e1000_m88_cable_length_table[0]))
+	ARRAY_SIZE(e1000_m88_cable_length_table)