drivers/infiniband/hw/mlx4: convert to using idr_alloc_cyclic()
authorJeff Layton <jlayton@redhat.com>
Mon, 29 Apr 2013 23:21:19 +0000 (16:21 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 30 Apr 2013 01:28:41 +0000 (18:28 -0700)
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>
drivers/infiniband/hw/mlx4/cm.c

index add98d0..d1f5f1d 100644 (file)
@@ -204,7 +204,6 @@ static struct id_map_entry *
 id_map_alloc(struct ib_device *ibdev, int slave_id, u32 sl_cm_id)
 {
        int ret;
-       static int next_id;
        struct id_map_entry *ent;
        struct mlx4_ib_sriov *sriov = &to_mdev(ibdev)->sriov;
 
@@ -223,9 +222,8 @@ id_map_alloc(struct ib_device *ibdev, int slave_id, u32 sl_cm_id)
        idr_preload(GFP_KERNEL);
        spin_lock(&to_mdev(ibdev)->sriov.id_map_lock);
 
-       ret = idr_alloc(&sriov->pv_id_table, ent, next_id, 0, GFP_NOWAIT);
+       ret = idr_alloc_cyclic(&sriov->pv_id_table, ent, 0, 0, GFP_NOWAIT);
        if (ret >= 0) {
-               next_id = max(ret + 1, 0);
                ent->pv_cm_id = (u32)ret;
                sl_id_map_add(ibdev, ent);
                list_add_tail(&ent->list, &sriov->cm_list);