diff mbox

[1/1] drivers/infiniband/core/cm.c: convert to using idr_alloc_cyclic()

Message ID 20131115221638.B53C31E418F@corp2gmr1-2.eem.corp.google.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Andrew Morton Nov. 15, 2013, 10:16 p.m. UTC
From: Zhao Hongjiang <zhaohongjiang@huawei.com>
Subject: drivers/infiniband/core/cm.c: convert to using idr_alloc_cyclic()

commit 3e6628c4b347 ("idr: introduce idr_alloc_cyclic()") adds a new
idr_alloc_cyclic routine and converts several of these users to it.  This
is just a missed one - add it.

Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com>
Cc: Roland Dreier <roland@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/infiniband/core/cm.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff mbox

Patch

diff -puN drivers/infiniband/core/cm.c~drivers-infiniband-core-cmc-convert-to-using-idr_alloc_cyclic drivers/infiniband/core/cm.c
--- a/drivers/infiniband/core/cm.c~drivers-infiniband-core-cmc-convert-to-using-idr_alloc_cyclic
+++ a/drivers/infiniband/core/cm.c
@@ -383,14 +383,11 @@  static int cm_alloc_id(struct cm_id_priv
 {
 	unsigned long flags;
 	int id;
-	static int next_id;
 
 	idr_preload(GFP_KERNEL);
 	spin_lock_irqsave(&cm.lock, flags);
 
-	id = idr_alloc(&cm.local_id_table, cm_id_priv, next_id, 0, GFP_NOWAIT);
-	if (id >= 0)
-		next_id = max(id + 1, 0);
+	id = idr_alloc_cyclic(&cm.local_id_table, cm_id_priv, 0, 0, GFP_NOWAIT);
 
 	spin_unlock_irqrestore(&cm.lock, flags);
 	idr_preload_end();