From: Zhao Hongjiang Date: Thu, 23 May 2013 00:37:00 +0000 (+1000) Subject: drivers/infiniband/core/cm.c: convert to using idr_alloc_cyclic() X-Git-Tag: next-20130527~1^2~245 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=687f731bd0729800d9a8a32aa327664bd9d34045;p=karo-tx-linux.git 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 Cc: Roland Dreier Cc: Tejun Heo Cc: Sean Hefty Signed-off-by: Andrew Morton --- 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) { 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();