From patchwork Wed Mar 27 19:29:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 2352941 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 905EAE00E6 for ; Wed, 27 Mar 2013 19:32:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754523Ab3C0TcD (ORCPT ); Wed, 27 Mar 2013 15:32:03 -0400 Received: from mail-ob0-f178.google.com ([209.85.214.178]:40848 "EHLO mail-ob0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754254Ab3C0T3q (ORCPT ); Wed, 27 Mar 2013 15:29:46 -0400 Received: by mail-ob0-f178.google.com with SMTP id wd20so8406511obb.23 for ; Wed, 27 Mar 2013 12:29:46 -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=P8j8/Cd1gpXcGhbNo8ZkXfUWxPJTHS9Bdhp/toLJnmg=; b=kb4ijgX67DXgowYB3T3WrgIzUkDHzi/+VdY2T8Gy9RtYMSyLDz44MJRf+ttWuurz3W x2+/wXlKUOxYb//5GIZvnbWvSq4hRDblBtUnJkfiGrAwnze4HSeGwM3VM8PQwFir2izO eHdmKqeiMT2v4anMRe51JsiMY7WopNStPcv7DkvxnmIpKR2rlRPTQzIW9j2yNZvmg/SA zk3Q5iOJ0/PgPOKIXhtyjGYaSgnEecV/tTBrERFHscTILmmM3ri263OydlPMFXiAHvI1 rgq9yEuTvR5K4PgdNVcDRWmW9bjqBxNnRP4UPImDwDltp4unlUBWC3JP0VcMvWxVaDFU oZ8A== X-Received: by 10.60.29.129 with SMTP id k1mr16166590oeh.8.1364412586371; Wed, 27 Mar 2013 12:29:46 -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 t9sm21559418obk.13.2013.03.27.12.29.45 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 27 Mar 2013 12:29:45 -0700 (PDT) From: Jeff Layton To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, tj@kernel.org, Jack Morgenstein , Or Gerlitz , Roland Dreier , linux-rdma@vger.kernel.org Subject: [PATCH v2 3/6] mlx4: convert to using idr_alloc_cyclic Date: Wed, 27 Mar 2013 15:29:35 -0400 Message-Id: <1364412578-7462-4-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1364412578-7462-1-git-send-email-jlayton@redhat.com> References: <1364412578-7462-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQkmvC/xlt9ijjPtfrcUXtmZrvN1pmE3vP65F5Z5QBrz6KvjoiQSSyPt8Nc7XudCHAYmZyuI 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: Jack Morgenstein Cc: Or Gerlitz Cc: Roland Dreier Cc: linux-rdma@vger.kernel.org --- drivers/infiniband/hw/mlx4/cm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/cm.c b/drivers/infiniband/hw/mlx4/cm.c index add98d0..d1f5f1d 100644 --- a/drivers/infiniband/hw/mlx4/cm.c +++ b/drivers/infiniband/hw/mlx4/cm.c @@ -204,7 +204,6 @@ static struct id_map_entry * id_map_alloc(struct ib_device *ibdev, int slave_id, u32 sl_cm_id) { int ret; - static int next_id; struct id_map_entry *ent; struct mlx4_ib_sriov *sriov = &to_mdev(ibdev)->sriov; @@ -223,9 +222,8 @@ id_map_alloc(struct ib_device *ibdev, int slave_id, u32 sl_cm_id) idr_preload(GFP_KERNEL); spin_lock(&to_mdev(ibdev)->sriov.id_map_lock); - ret = idr_alloc(&sriov->pv_id_table, ent, next_id, 0, GFP_NOWAIT); + ret = idr_alloc_cyclic(&sriov->pv_id_table, ent, 0, 0, GFP_NOWAIT); if (ret >= 0) { - next_id = max(ret + 1, 0); ent->pv_cm_id = (u32)ret; sl_id_map_add(ibdev, ent); list_add_tail(&ent->list, &sriov->cm_list);