aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-02-27 20:04:17 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 22:10:16 -0500
commitac1d68296b2504cd878e328be21eebb6093b7f27 (patch)
tree7b4bcd351e8e870cfe80e9c0d1f23985d1db0b93
parent3b069c5d857a5f1b8cb6bb74c70d9446089f5077 (diff)
IB/amso1100: convert to idr_alloc()
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <tj@kernel.org> Reviewed-by: Steve Wise <swise@opengridcomputing.com> Cc: Tom Tucker <tom@opengridcomputing.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/infiniband/hw/amso1100/c2_qp.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/amso1100/c2_qp.c b/drivers/infiniband/hw/amso1100/c2_qp.c
index 28cd5cb51859..0ab826b280b2 100644
--- a/drivers/infiniband/hw/amso1100/c2_qp.c
+++ b/drivers/infiniband/hw/amso1100/c2_qp.c
@@ -382,14 +382,17 @@ static int c2_alloc_qpn(struct c2_dev *c2dev, struct c2_qp *qp)
382{ 382{
383 int ret; 383 int ret;
384 384
385 do { 385 idr_preload(GFP_KERNEL);
386 spin_lock_irq(&c2dev->qp_table.lock); 386 spin_lock_irq(&c2dev->qp_table.lock);
387 ret = idr_get_new_above(&c2dev->qp_table.idr, qp, 387
388 c2dev->qp_table.last++, &qp->qpn); 388 ret = idr_alloc(&c2dev->qp_table.idr, qp, c2dev->qp_table.last++, 0,
389 spin_unlock_irq(&c2dev->qp_table.lock); 389 GFP_NOWAIT);
390 } while ((ret == -EAGAIN) && 390 if (ret >= 0)
391 idr_pre_get(&c2dev->qp_table.idr, GFP_KERNEL)); 391 qp->qpn = ret;
392 return ret; 392
393 spin_unlock_irq(&c2dev->qp_table.lock);
394 idr_preload_end();
395 return ret < 0 ? ret : 0;
393} 396}
394 397
395static void c2_free_qpn(struct c2_dev *c2dev, int qpn) 398static void c2_free_qpn(struct c2_dev *c2dev, int qpn)