diff options
author | Jeff Layton <jlayton@redhat.com> | 2013-04-29 19:21:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 21:28:41 -0400 |
commit | f2d9db877fdfe37b54428880429cf01f68718aad (patch) | |
tree | b6c13a80f0de49fb29b0c7eb5f5f83ff1ea47d61 | |
parent | c027e44677e139d68197f25688f0c58291b26c90 (diff) |
drivers/infiniband/hw/mlx4: convert to using idr_alloc_cyclic()
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Jack Morgenstein <jackm@dev.mellanox.co.il>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Cc: Roland Dreier <roland@purestorage.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/infiniband/hw/mlx4/cm.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/mlx4/cm.c b/drivers/infiniband/hw/mlx4/cm.c index add98d01476c..d1f5f1dd77b0 100644 --- a/drivers/infiniband/hw/mlx4/cm.c +++ b/drivers/infiniband/hw/mlx4/cm.c | |||
@@ -204,7 +204,6 @@ static struct id_map_entry * | |||
204 | id_map_alloc(struct ib_device *ibdev, int slave_id, u32 sl_cm_id) | 204 | id_map_alloc(struct ib_device *ibdev, int slave_id, u32 sl_cm_id) |
205 | { | 205 | { |
206 | int ret; | 206 | int ret; |
207 | static int next_id; | ||
208 | struct id_map_entry *ent; | 207 | struct id_map_entry *ent; |
209 | struct mlx4_ib_sriov *sriov = &to_mdev(ibdev)->sriov; | 208 | struct mlx4_ib_sriov *sriov = &to_mdev(ibdev)->sriov; |
210 | 209 | ||
@@ -223,9 +222,8 @@ id_map_alloc(struct ib_device *ibdev, int slave_id, u32 sl_cm_id) | |||
223 | idr_preload(GFP_KERNEL); | 222 | idr_preload(GFP_KERNEL); |
224 | spin_lock(&to_mdev(ibdev)->sriov.id_map_lock); | 223 | spin_lock(&to_mdev(ibdev)->sriov.id_map_lock); |
225 | 224 | ||
226 | ret = idr_alloc(&sriov->pv_id_table, ent, next_id, 0, GFP_NOWAIT); | 225 | ret = idr_alloc_cyclic(&sriov->pv_id_table, ent, 0, 0, GFP_NOWAIT); |
227 | if (ret >= 0) { | 226 | if (ret >= 0) { |
228 | next_id = max(ret + 1, 0); | ||
229 | ent->pv_cm_id = (u32)ret; | 227 | ent->pv_cm_id = (u32)ret; |
230 | sl_id_map_add(ibdev, ent); | 228 | sl_id_map_add(ibdev, ent); |
231 | list_add_tail(&ent->list, &sriov->cm_list); | 229 | list_add_tail(&ent->list, &sriov->cm_list); |