Skip to content

Commit

Permalink
IB/amso1100: convert to idr_alloc()
Browse files Browse the repository at this point in the history
Convert to the much saner new idr interface.

Signed-off-by: Tejun Heo <[email protected]>
Reviewed-by: Steve Wise <[email protected]>
Cc: Tom Tucker <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
htejun authored and torvalds committed Feb 28, 2013
1 parent 3b069c5 commit ac1d682
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions drivers/infiniband/hw/amso1100/c2_qp.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,17 @@ static int c2_alloc_qpn(struct c2_dev *c2dev, struct c2_qp *qp)
{
int ret;

do {
spin_lock_irq(&c2dev->qp_table.lock);
ret = idr_get_new_above(&c2dev->qp_table.idr, qp,
c2dev->qp_table.last++, &qp->qpn);
spin_unlock_irq(&c2dev->qp_table.lock);
} while ((ret == -EAGAIN) &&
idr_pre_get(&c2dev->qp_table.idr, GFP_KERNEL));
return ret;
idr_preload(GFP_KERNEL);
spin_lock_irq(&c2dev->qp_table.lock);

ret = idr_alloc(&c2dev->qp_table.idr, qp, c2dev->qp_table.last++, 0,
GFP_NOWAIT);
if (ret >= 0)
qp->qpn = 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)
Expand Down

0 comments on commit ac1d682

Please sign in to comment.