Re: [PATCH 1/1] IB: rxe: replace ARRAYSIZE with RXE_NUM_OF_COUNTERS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/15/18 12:09 AM, Zhu Yanjun wrote:
RXE_NUM_OF_COUNTERS is the number of counters. So it can be used
directly.

Signed-off-by: Zhu Yanjun <yanjun.zhu@xxxxxxxxxx>
---
  drivers/infiniband/sw/rxe/rxe_hw_counters.c | 7 +++----
  1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_hw_counters.c b/drivers/infiniband/sw/rxe/rxe_hw_counters.c
index 6aeb7a165e46..8df4b1592d6d 100644
--- a/drivers/infiniband/sw/rxe/rxe_hw_counters.c
+++ b/drivers/infiniband/sw/rxe/rxe_hw_counters.c
@@ -58,21 +58,20 @@ int rxe_ib_get_hw_stats(struct ib_device *ibdev,
  	if (!port || !stats)
  		return -EINVAL;
- for (cnt = 0; cnt < ARRAY_SIZE(rxe_counter_name); cnt++)
+	for (cnt = 0; cnt  < RXE_NUM_OF_COUNTERS; cnt++)
  		stats->value[cnt] = dev->stats_counters[cnt];
- return ARRAY_SIZE(rxe_counter_name);
+	return RXE_NUM_OF_COUNTERS;
  }
struct rdma_hw_stats *rxe_ib_alloc_hw_stats(struct ib_device *ibdev,
  					    u8 port_num)
  {
-	BUILD_BUG_ON(ARRAY_SIZE(rxe_counter_name) != RXE_NUM_OF_COUNTERS);
  	/* We support only per port stats */
  	if (!port_num)
  		return NULL;
return rdma_alloc_hw_stats_struct(rxe_counter_name,
-					  ARRAY_SIZE(rxe_counter_name),
+					  RXE_NUM_OF_COUNTERS,
  					  RDMA_HW_STATS_DEFAULT_LIFESPAN);
  }

Have you considered to make the opposite change, namely to remove the RXE_NUM_OF_COUNTERS constant and to use ARRAY_SIZE(rxe_counter_name) everywhere instead?

Thanks,

Bart.





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux