summaryrefslogtreecommitdiff
path: root/drivers/infiniband/core/cache.c
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2019-02-13 07:12:47 +0300
committerJason Gunthorpe <jgg@mellanox.com>2019-02-19 20:13:39 +0300
commitea1075edcbab7d92f4e4ccf5490043f796bf78be (patch)
tree618fb95aa42e446d18020d6851bab321be2c3b4b /drivers/infiniband/core/cache.c
parentf2a0e45f36b0a210ff2388ed5fa89f81019c07a1 (diff)
downloadlinux-ea1075edcbab7d92f4e4ccf5490043f796bf78be.tar.xz
RDMA: Add and use rdma_for_each_port
We have many loops iterating over all of the end port numbers on a struct ib_device, simplify them with a for_each helper. Reviewed-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/cache.c')
-rw-r--r--drivers/infiniband/core/cache.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index 2338d0b3a0ca..3d137d8381a9 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -1428,7 +1428,7 @@ static void ib_cache_event(struct ib_event_handler *handler,
int ib_cache_setup_one(struct ib_device *device)
{
- int p;
+ unsigned int p;
int err;
rwlock_init(&device->cache.lock);
@@ -1447,8 +1447,8 @@ int ib_cache_setup_one(struct ib_device *device)
return err;
}
- for (p = 0; p <= rdma_end_port(device) - rdma_start_port(device); ++p)
- ib_cache_update(device, p + rdma_start_port(device), true);
+ rdma_for_each_port (device, p)
+ ib_cache_update(device, p, true);
INIT_IB_EVENT_HANDLER(&device->cache.event_handler,
device, ib_cache_event);