From patchwork Thu May 2 03:01:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Hongjiang X-Patchwork-Id: 2509931 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id CADB7DF230 for ; Thu, 2 May 2013 03:03:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760087Ab3EBDDD (ORCPT ); Wed, 1 May 2013 23:03:03 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:27092 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757908Ab3EBDDC (ORCPT ); Wed, 1 May 2013 23:03:02 -0400 Received: from 172.24.2.119 (EHLO szxeml208-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id BAY41425; Thu, 02 May 2013 11:02:53 +0800 (CST) Received: from SZXEML449-HUB.china.huawei.com (10.82.67.192) by szxeml208-edg.china.huawei.com (172.24.2.57) with Microsoft SMTP Server (TLS) id 14.1.323.7; Thu, 2 May 2013 11:01:52 +0800 Received: from [127.0.0.1] (10.135.72.200) by szxeml449-hub.china.huawei.com (10.82.67.192) with Microsoft SMTP Server id 14.1.323.7; Thu, 2 May 2013 11:01:52 +0800 Message-ID: <5181D71C.2010106@huawei.com> Date: Thu, 2 May 2013 11:01:48 +0800 From: Zhao Hongjiang User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Andrew Morton CC: , , , , Subject: [PATCH] drivers/infiniband/core/cm: convert to using idr_alloc_cyclic() X-Originating-IP: [10.135.72.200] X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org The 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 miss one, add it. Signed-off-by: Zhao Hongjiang --- drivers/infiniband/core/cm.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 784b97c..f2ef7ef 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();