From patchwork Fri Sep 13 21:50:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 2892521 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 A851F9F23C for ; Fri, 13 Sep 2013 22:15:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD20320218 for ; Fri, 13 Sep 2013 22:15:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0604D201BC for ; Fri, 13 Sep 2013 22:15:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755321Ab3IMWP4 (ORCPT ); Fri, 13 Sep 2013 18:15:56 -0400 Received: from mail-ve0-f201.google.com ([209.85.128.201]:38019 "EHLO mail-ve0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755302Ab3IMWP4 (ORCPT ); Fri, 13 Sep 2013 18:15:56 -0400 Received: by mail-ve0-f201.google.com with SMTP id c14so229913vea.4 for ; Fri, 13 Sep 2013 15:15:55 -0700 (PDT) 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=JrUqKEUVRJ3pOMZ/Td3eZvuy3KpmQ+2racRIN5UwU/ipTKGiIMaZMrU2rwiPRf+rV6 M73l/SV32SfTlFLBH6kK24c3AM4XtoBSqw+uNGY0xpxijGJxCPzhNpFqEw3OZZFzHyCa 7ujc5IMTZ4JsmMebU/COpSZx/e19Imd57zsZB2toCiRVyFJ9WLCKM18eie5x7DkdmI9D QtpcBwlr9rXLFexMIfloX4b/32CN1mdtsh9CSaNKVj8LGyYCH1ZJticWmU3FuH+bXQyM +ftCSkwoxvKS20+bFhoP6DXhj9U/bPzbWLuIpVV3chv8UR3ylzwrByyNpHmdpwaHDH1T NFew== X-Gm-Message-State: ALoCoQmgrbXp1PVGiyz1xpM4xs0MGUufFI9OXULRArZ9e5MJpa8Rfneh+AoGp9PbsdU8Tm4bIedW X-Received: by 10.236.56.70 with SMTP id l46mr6273887yhc.2.1379109054493; Fri, 13 Sep 2013 14:50:54 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id z45si784742yha.7.1969.12.31.16.00.00 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Fri, 13 Sep 2013 14:50:54 -0700 (PDT) Received: from localhost.localdomain (akpm3.mtv.corp.google.com [172.17.131.127]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id DF5195A41B0; Fri, 13 Sep 2013 14:50:53 -0700 (PDT) Subject: [patch 1/1] drivers/infiniband/core/cm.c: convert to using idr_alloc_cyclic() To: roland@kernel.org Cc: linux-rdma@vger.kernel.org, akpm@linux-foundation.org, zhaohongjiang@huawei.com, sean.hefty@intel.com, tj@kernel.org From: akpm@linux-foundation.org Date: Fri, 13 Sep 2013 14:50:53 -0700 MIME-Version: 1.0 Message-Id: <20130913215053.DF5195A41B0@corp2gmr1-2.hot.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=-7.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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();