From patchwork Wed Feb 6 19:40:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 2107191 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 29DA83FCFC for ; Wed, 6 Feb 2013 19:59:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758255Ab3BFTuq (ORCPT ); Wed, 6 Feb 2013 14:50:46 -0500 Received: from mail-ia0-f174.google.com ([209.85.210.174]:33095 "EHLO mail-ia0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758242Ab3BFTun (ORCPT ); Wed, 6 Feb 2013 14:50:43 -0500 Received: by mail-ia0-f174.google.com with SMTP id o25so2018151iad.19 for ; Wed, 06 Feb 2013 11:50:42 -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=9cyyQvH2Y6K66C0y01h86qjyGnsrd1bM8j9ZJlA8Ej0=; b=lWl5mluedJUsyfOYnXZcYW+Y1v8YCmVAowrqYn/phftdAgkLR4SJUxrwWqSUuDGSqw p2YHjsSEaSbJ01RM4O28dooIOUwSOIy6xg7PvFgj4tT+A09mFlXwxNRIxBuWVqiz97tU yP1uQ90HxJfrakt21Buaq76FhqMb/qfKafJP3v+ZUrKVRusdVOwOoKQir3TLcS09RE2J JBSKP6hOcgS/NgDijBbaoVYrk02+68M02F8VIjIAEuxtPqCgLGNrBoNlFwgxzfRpkWp5 ykvaCcsAZXeIIU0PYrpCZJVW2R+pVcWpbAwb9aINfHjB7liJHtOXMa1J73EJ0foWFrbA 19xg== X-Received: by 10.50.12.201 with SMTP id a9mr8965886igc.10.1360180237796; Wed, 06 Feb 2013 11:50:37 -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 l5sm39989590pax.10.2013.02.06.11.50.36 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 06 Feb 2013 11:50:37 -0800 (PST) From: Tejun Heo To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, Tejun Heo , Roland Dreier , linux-rdma@vger.kernel.org Subject: [PATCH 45/77] IB/ocrdma: convert to idr_alloc() Date: Wed, 6 Feb 2013 11:40:17 -0800 Message-Id: <1360179649-22465-46-git-send-email-tj@kernel.org> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1360179649-22465-1-git-send-email-tj@kernel.org> References: <1360179649-22465-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 --- 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;