aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-02-27 20:04:24 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 22:10:17 -0500
commitcffcd59f15db02b341e50da653860afa0ba11a83 (patch)
treec7cf95544ce17a3ae516c322aada152996c0fb7c /drivers/infiniband
parent6a9200603d76de1f8029b83c041f8eef99877a65 (diff)
IB/ocrdma: convert to idr_alloc()
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Roland Dreier <roland@purestorage.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_main.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index c4e0131f1b57..48928c8e7774 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);
51 51
52static union ib_gid ocrdma_zero_sgid; 52static union ib_gid ocrdma_zero_sgid;
53 53
54static int ocrdma_get_instance(void)
55{
56 int instance = 0;
57
58 /* Assign an unused number */
59 if (!idr_pre_get(&ocrdma_dev_id, GFP_KERNEL))
60 return -1;
61 if (idr_get_new(&ocrdma_dev_id, NULL, &instance))
62 return -1;
63 return instance;
64}
65
66void ocrdma_get_guid(struct ocrdma_dev *dev, u8 *guid) 54void ocrdma_get_guid(struct ocrdma_dev *dev, u8 *guid)
67{ 55{
68 u8 mac_addr[6]; 56 u8 mac_addr[6];
@@ -416,7 +404,7 @@ static struct ocrdma_dev *ocrdma_add(struct be_dev_info *dev_info)
416 goto idr_err; 404 goto idr_err;
417 405
418 memcpy(&dev->nic_info, dev_info, sizeof(*dev_info)); 406 memcpy(&dev->nic_info, dev_info, sizeof(*dev_info));
419 dev->id = ocrdma_get_instance(); 407 dev->id = idr_alloc(&ocrdma_dev_id, NULL, 0, 0, GFP_KERNEL);
420 if (dev->id < 0) 408 if (dev->id < 0)
421 goto idr_err; 409 goto idr_err;
422 410