From patchwork Sun Feb 3 01:20:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 2085671 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 5439E3FD2B for ; Sun, 3 Feb 2013 01:30:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753758Ab3BCBWP (ORCPT ); Sat, 2 Feb 2013 20:22:15 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:49153 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753742Ab3BCBWN (ORCPT ); Sat, 2 Feb 2013 20:22:13 -0500 Received: by mail-pa0-f50.google.com with SMTP id fa11so229341pad.9 for ; Sat, 02 Feb 2013 17:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=59pWnVLWaUc1BD5iMD921N1zLXQYePgHkSGp+oGxp2c=; b=nyWvP+yyMyjU4NeKdRqccJhXm8oAzdkLWWsB3Naj1/yza14GwMycOUActJkGz6EJcw faispCXke4S7Or0D2WJtk+CW+Ijn33ugdoSwo7flfHYb0IrQaIsmh77jTC93limKVXNc VKpubpnDyZf01g9SjlSwdJK3+/iTQMmktGd/j2vao/hYKZeiIXIRkLq4zqVk6tgHyuDH BmxK4032Rvdpx9NCrxdvB/heHgN4bNV1pHm+kzXDx1TOkFrwxwEtNLFOY2HYYxPgavYg FWGS1iYIlxmT/FxpsPAB4Rwp4dkSeIgx6oDEeY64jKT4JU9zRtdO5n/wIiRtmouecyNI 8PWA== X-Received: by 10.68.232.194 with SMTP id tq2mr44268782pbc.43.1359854532892; Sat, 02 Feb 2013 17:22:12 -0800 (PST) Received: from htj.dyndns.org (c-69-181-251-227.hsd1.ca.comcast.net. [69.181.251.227]) by mx.google.com with ESMTPS id hs2sm13149467pbc.22.2013.02.02.17.22.11 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 02 Feb 2013 17:22:12 -0800 (PST) From: Tejun Heo To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, rusty@rustcorp.com.au, bfields@fieldses.org, skinsbursky@parallels.com, ebiederm@xmission.com, jmorris@namei.org, axboe@kernel.dk, Tejun Heo , Roland Dreier , linux-rdma@vger.kernel.org Subject: [PATCH 29/62] infiniband/ocrdma: convert to idr_alloc() Date: Sat, 2 Feb 2013 17:20:30 -0800 Message-Id: <1359854463-2538-30-git-send-email-tj@kernel.org> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1359854463-2538-1-git-send-email-tj@kernel.org> References: <1359854463-2538-1-git-send-email-tj@kernel.org> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Convert to the much saner new idr interface. Only compile tested. Signed-off-by: Tejun Heo Cc: Roland Dreier Cc: linux-rdma@vger.kernel.org --- This patch depends on an earlier idr changes and I think it would be best to route these together through -mm. Please holler if there's any objection. Thanks. drivers/infiniband/hw/ocrdma/ocrdma_main.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c index c4e0131..48928c8 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c @@ -51,18 +51,6 @@ static DEFINE_IDR(ocrdma_dev_id); static union ib_gid ocrdma_zero_sgid; -static int ocrdma_get_instance(void) -{ - int instance = 0; - - /* Assign an unused number */ - if (!idr_pre_get(&ocrdma_dev_id, GFP_KERNEL)) - return -1; - if (idr_get_new(&ocrdma_dev_id, NULL, &instance)) - return -1; - return instance; -} - void ocrdma_get_guid(struct ocrdma_dev *dev, u8 *guid) { u8 mac_addr[6]; @@ -416,7 +404,7 @@ static struct ocrdma_dev *ocrdma_add(struct be_dev_info *dev_info) goto idr_err; memcpy(&dev->nic_info, dev_info, sizeof(*dev_info)); - dev->id = ocrdma_get_instance(); + dev->id = idr_alloc(&ocrdma_dev_id, NULL, 0, 0, GFP_KERNEL); if (dev->id < 0) goto idr_err;