aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core
diff options
context:
space:
mode:
authorZhao Hongjiang <zhaohongjiang@huawei.com>2013-11-15 17:16:37 -0500
committerRoland Dreier <roland@purestorage.com>2013-11-16 13:30:42 -0500
commitab626d1a68d1aee19a5c7d889b9fbeace6a92b41 (patch)
treed893382d94274f51ff6b2bc673440fe46af973b4 /drivers/infiniband/core
parent1c636f801615bdfc9b1d46904e8258c7a025670b (diff)
IB/cm: 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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r--drivers/infiniband/core/cm.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 784b97cb05b0..f2ef7ef0f36f 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -383,14 +383,11 @@ static int cm_alloc_id(struct cm_id_private *cm_id_priv)
383{ 383{
384 unsigned long flags; 384 unsigned long flags;
385 int id; 385 int id;
386 static int next_id;
387 386
388 idr_preload(GFP_KERNEL); 387 idr_preload(GFP_KERNEL);
389 spin_lock_irqsave(&cm.lock, flags); 388 spin_lock_irqsave(&cm.lock, flags);
390 389
391 id = idr_alloc(&cm.local_id_table, cm_id_priv, next_id, 0, GFP_NOWAIT); 390 id = idr_alloc_cyclic(&cm.local_id_table, cm_id_priv, 0, 0, GFP_NOWAIT);
392 if (id >= 0)
393 next_id = max(id + 1, 0);
394 391
395 spin_unlock_irqrestore(&cm.lock, flags); 392 spin_unlock_irqrestore(&cm.lock, flags);
396 idr_preload_end(); 393 idr_preload_end();