Commit ac1d6829 authored by Tejun Heo's avatar Tejun Heo Committed by Linus Torvalds

IB/amso1100: convert to idr_alloc()

Convert to the much saner new idr interface.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Reviewed-by: default avatarSteve Wise <swise@opengridcomputing.com>
Cc: Tom Tucker <tom@opengridcomputing.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3b069c5d
...@@ -382,14 +382,17 @@ static int c2_alloc_qpn(struct c2_dev *c2dev, struct c2_qp *qp) ...@@ -382,14 +382,17 @@ static int c2_alloc_qpn(struct c2_dev *c2dev, struct c2_qp *qp)
{ {
int ret; int ret;
do { idr_preload(GFP_KERNEL);
spin_lock_irq(&c2dev->qp_table.lock); spin_lock_irq(&c2dev->qp_table.lock);
ret = idr_get_new_above(&c2dev->qp_table.idr, qp,
c2dev->qp_table.last++, &qp->qpn); ret = idr_alloc(&c2dev->qp_table.idr, qp, c2dev->qp_table.last++, 0,
spin_unlock_irq(&c2dev->qp_table.lock); GFP_NOWAIT);
} while ((ret == -EAGAIN) && if (ret >= 0)
idr_pre_get(&c2dev->qp_table.idr, GFP_KERNEL)); qp->qpn = ret;
return ret;
spin_unlock_irq(&c2dev->qp_table.lock);
idr_preload_end();
return ret < 0 ? ret : 0;
} }
static void c2_free_qpn(struct c2_dev *c2dev, int qpn) static void c2_free_qpn(struct c2_dev *c2dev, int qpn)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment