From patchwork Wed Mar 27 13:18:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 2350661 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 29F5CDFE82 for ; Wed, 27 Mar 2013 13:19:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751226Ab3C0NSV (ORCPT ); Wed, 27 Mar 2013 09:18:21 -0400 Received: from mail-ob0-f182.google.com ([209.85.214.182]:36248 "EHLO mail-ob0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752411Ab3C0NSU (ORCPT ); Wed, 27 Mar 2013 09:18:20 -0400 Received: by mail-ob0-f182.google.com with SMTP id ef5so5491546obb.27 for ; Wed, 27 Mar 2013 06:18:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=PAqYww3W3PbKIMtkWtRPeHRea6ZqH/vIQv2RLUVxDqI=; b=aTsHY48TSkMkWTwz1p7GaxSpP/HdsYdoA02Nhv+BEGbFFXWYwVEwBRVBANc0I3xK5G pieXDE+uPEIJnCwJNAkm/7rIHphPPAj24hL7L9pjKBA6PH2VCHvMNZt6Tmm0FUfiTxrp /031Fm44FEyq+yDilEskPxXta49Xk5977wmTxlIEMMf4ySLb+vxEXU+a41gJGl6UB7K9 1EO3unD7QaoG9p0Xhg+bUy+if/5RJ9aEDJODFPj/lJuDjS8QgSk8Lh1CbPk4gKs/A22J ED3jl6xu5V7At1d9DMyfDmniiuOcBIMeS7CA/7tSPmAGKTk2KbSaGy8KinpmH2Jaf71a bq+w== X-Received: by 10.182.113.40 with SMTP id iv8mr3685408obb.12.1364390299406; Wed, 27 Mar 2013 06:18:19 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-107-015-113-143.nc.res.rr.com. [107.15.113.143]) by mx.google.com with ESMTPS id zc8sm14103721obc.8.2013.03.27.06.18.17 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 27 Mar 2013 06:18:18 -0700 (PDT) From: Jeff Layton To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, tj@kernel.org, Steve Wise , Tom Tucker , linux-rdma@vger.kernel.org Subject: [PATCH v1 2/6] amso1100: convert to using idr_alloc_cyclic Date: Wed, 27 Mar 2013 09:18:04 -0400 Message-Id: <1364390288-30968-3-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1364390288-30968-1-git-send-email-jlayton@redhat.com> References: <1364390288-30968-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQn1r/C9/mqKy98NbB5pY1imNJKguRkGXt/8wnKpwUPfP5M7nPwWSk+s+7WOZzcL66Jz/q/v Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org (Note: compile-tested only) Signed-off-by: Jeff Layton Cc: Tejun Heo Cc: Steve Wise Cc: Tom Tucker Cc: linux-rdma@vger.kernel.org --- drivers/infiniband/hw/amso1100/c2.h | 1 - drivers/infiniband/hw/amso1100/c2_qp.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/amso1100/c2.h b/drivers/infiniband/hw/amso1100/c2.h index ba7a1208..d619d73 100644 --- a/drivers/infiniband/hw/amso1100/c2.h +++ b/drivers/infiniband/hw/amso1100/c2.h @@ -265,7 +265,6 @@ struct c2_pd_table { struct c2_qp_table { struct idr idr; spinlock_t lock; - int last; }; struct c2_element { diff --git a/drivers/infiniband/hw/amso1100/c2_qp.c b/drivers/infiniband/hw/amso1100/c2_qp.c index 0ab826b..703b33f 100644 --- a/drivers/infiniband/hw/amso1100/c2_qp.c +++ b/drivers/infiniband/hw/amso1100/c2_qp.c @@ -385,8 +385,7 @@ static int c2_alloc_qpn(struct c2_dev *c2dev, struct c2_qp *qp) idr_preload(GFP_KERNEL); spin_lock_irq(&c2dev->qp_table.lock); - ret = idr_alloc(&c2dev->qp_table.idr, qp, c2dev->qp_table.last++, 0, - GFP_NOWAIT); + ret = idr_alloc_cyclic(&c2dev->qp_table.idr, qp, 0, 0, GFP_NOWAIT); if (ret >= 0) qp->qpn = ret; @@ -1016,7 +1015,7 @@ out: void c2_init_qp_table(struct c2_dev *c2dev) { spin_lock_init(&c2dev->qp_table.lock); - idr_init(&c2dev->qp_table.idr); + idr_init_cyclic(&c2dev->qp_table.idr, 0); } void c2_cleanup_qp_table(struct c2_dev *c2dev)