diff options
author | Parav Pandit <parav@nvidia.com> | 2021-01-27 18:00:09 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2021-02-03 02:25:40 +0300 |
commit | 6504c772551e809b4cc21fa720d6bba703d5c199 (patch) | |
tree | 07ae00b4d7cea0379e95e155c2abe37cfefd1f0c /drivers/infiniband/hw/mlx4/sysfs.c | |
parent | 131be26750379592f0dd6244b2a90bbb504a10bb (diff) | |
download | linux-6504c772551e809b4cc21fa720d6bba703d5c199.tar.xz |
IB/mlx4: Use port iterator and validation APIs
Use IB core provided routine to check if the port is valid or not and to
iterate over IB ports.
Link: https://lore.kernel.org/r/20210127150010.1876121-10-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>
Diffstat (limited to 'drivers/infiniband/hw/mlx4/sysfs.c')
-rw-r--r-- | drivers/infiniband/hw/mlx4/sysfs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/mlx4/sysfs.c b/drivers/infiniband/hw/mlx4/sysfs.c index 1b5891130aab..24ee79aa2122 100644 --- a/drivers/infiniband/hw/mlx4/sysfs.c +++ b/drivers/infiniband/hw/mlx4/sysfs.c @@ -798,7 +798,7 @@ static void unregister_pkey_tree(struct mlx4_ib_dev *device) int mlx4_ib_device_register_sysfs(struct mlx4_ib_dev *dev) { - int i; + unsigned int i; int ret = 0; if (!mlx4_is_master(dev->dev)) @@ -817,7 +817,7 @@ int mlx4_ib_device_register_sysfs(struct mlx4_ib_dev *dev) goto err_ports; } - for (i = 1; i <= dev->ib_dev.phys_port_cnt; ++i) { + rdma_for_each_port(&dev->ib_dev, i) { ret = add_port_entries(dev, i); if (ret) goto err_add_entries; |