From patchwork Fri Nov 15 22:16:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 3190321 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 40B239F3AE for ; Fri, 15 Nov 2013 22:23:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3B6F6207E2 for ; Fri, 15 Nov 2013 22:23:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 60919207C9 for ; Fri, 15 Nov 2013 22:23:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751938Ab3KOWW7 (ORCPT ); Fri, 15 Nov 2013 17:22:59 -0500 Received: from mail-wg0-f74.google.com ([74.125.82.74]:52527 "EHLO mail-wg0-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751888Ab3KOWW6 (ORCPT ); Fri, 15 Nov 2013 17:22:58 -0500 X-Greylist: delayed 377 seconds by postgrey-1.27 at vger.kernel.org; Fri, 15 Nov 2013 17:22:58 EST Received: by mail-wg0-f74.google.com with SMTP id m15so223488wgh.5 for ; Fri, 15 Nov 2013 14:22:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:cc:from:date:mime-version :content-type:content-transfer-encoding:message-id; bh=poyXcppWNo9n8Tk4JrvBCrEAt5SStblYphrYqWU+kv0=; b=bhFZKQSdVCbG/YM5tliRHa4dcgiy9OaTehUEjShqXgGN42cp5210IMG4IyC5/kU/5a VvWYZCCE0g07wM7jXzyYVaYS0580v+P31viyJ5V4VMO8Z/TRiRGLneTX4Z/0yYRyxGvZ +S1xl8q7g82YmgmjpJxZTSts2IXDZKou6Z5LSIhW2Ieg7ONgsNKgNLaSHylpIjl0vUs+ pEgmfb/Cd4a0lTeVUppX1AL54JTbzyWbLapdPjlrT7PeyBZ3FLQS7cDYJxfwwFoHfNkc Rwu2Q2DwVTczmlRX4CnPG+9g48RCZhqu8/6Kr8vJ3FHvng5HX+IVNAr6b70t22cr53Vq AC6w== X-Gm-Message-State: ALoCoQl4Lqwbq/P1itMZA0iaxGzmWXAG77HfBe/IEgQI/DmaEnAldTtX3Ak0qnH7xjtUsMCOyBEU X-Received: by 10.180.93.202 with SMTP id cw10mr5157417wib.0.1384553800228; Fri, 15 Nov 2013 14:16:40 -0800 (PST) Received: from corp2gmr1-2.eem.corp.google.com (corp2gmr1-2.eem.corp.google.com [172.25.138.117]) by gmr-mx.google.com with ESMTPS id z4si970742eel.0.2013.11.15.14.16.40 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Nov 2013 14:16:40 -0800 (PST) Received: from localhost.localdomain (akpm3.mtv.corp.google.com [172.17.131.127]) by corp2gmr1-2.eem.corp.google.com (Postfix) with ESMTP id B53C31E418F; Fri, 15 Nov 2013 14:16:38 -0800 (PST) Subject: [patch 1/1] drivers/infiniband/core/cm.c: convert to using idr_alloc_cyclic() To: roland@kernel.org Cc: sean.hefty@intel.com, hal.rosenstock@gmail.com, linux-rdma@vger.kernel.org, akpm@linux-foundation.org, zhaohongjiang@huawei.com, tj@kernel.org From: akpm@linux-foundation.org Date: Fri, 15 Nov 2013 14:16:37 -0800 MIME-Version: 1.0 Message-Id: <20131115221638.B53C31E418F@corp2gmr1-2.eem.corp.google.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Zhao Hongjiang 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 Cc: Roland Dreier Cc: Tejun Heo Cc: Sean Hefty Signed-off-by: Andrew Morton --- drivers/infiniband/core/cm.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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();