From: Jiri Pirko > Sent: 15 April 2016 09:53 .. > >> @@ -106,10 +96,9 @@ static int mlxsw_sp_port_pb_init(struct mlxsw_sp_port > >> *mlxsw_sp_port) > >> mlxsw_reg_pbmc_pack(pbmc_pl, mlxsw_sp_port->local_port, > >> 0xffff, 0xffff / 2); > >> for (i = 0; i < MLXSW_SP_PBS_LEN; i++) { > > > >I'd rather see an explicit ARRAY_COUNT(mlxsw_sp_pbs) than some 'randon' > >constant. > > See "#define MLXSW_SP_PBS_LEN ARRAY_SIZE(mlxsw_sp_pbs)"
Imagine I'm reading the code quickly. If the for() loop uses ARRAY_COUNT(mlxsw_sp_pbs) then (provided I grok ARRAY_COUNT()) I know that the array bounds are honoured. When it uses MLXSW_SP_PBS_LEN I have to search for the definition in order to check that it is the correct value/constant for that array. David