IB/mlx5: Use rdma_for_each_port for port iteration
authorParav Pandit <parav@nvidia.com>
Wed, 3 Feb 2021 13:01:33 +0000 (15:01 +0200)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 5 Feb 2021 16:06:01 +0000 (12:06 -0400)
commit131796524fa346553d9a325ed77bbee0b63d0ca9
tree629c4b5fd4a73e74ea0f8017a1e23c4b4f4e60e7
parent7416790e22452bfa86de6b55638eacf7780c8f6f
IB/mlx5: Use rdma_for_each_port for port iteration

Instead of open coding the loop for port iteration, use rdma_for_each_port
macro provided by core.

To use such macro, early initialization of phys_port_cnt is needed.
Hence, initialize such constant early enough in the init stage.

Whichever functions are called with port using rdma_for_each_port(),
convert their port type from u8 to unsigned int to match the core API.

Link: https://lore.kernel.org/r/20210203130133.4057329-6-leon@kernel.org
Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/mlx5/mad.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/mlx5_ib.h