From b3b04a1fec3eae4bf2d5f0858df9de62c5a2d07b Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Wed, 27 Feb 2013 17:04:18 -0800 Subject: [PATCH] --- yaml --- r: 359343 b: refs/heads/master c: 6fa780095f058f0960f220754217701a53a9e403 h: refs/heads/master i: 359341: 794e58cb57d8d04405e51078153b72a90f7a876d 359339: bbb4dc2cfe18160fd75be20b9e69ef6b38b8df46 359335: fb38a63b48d7b03be5481439d228feea19fd5001 359327: a0d0aa6cc986bdf9025c72fe36484b60f2e1b93d v: v3 --- [refs] | 2 +- trunk/drivers/infiniband/hw/cxgb3/iwch.h | 24 +++++++++++------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/[refs] b/[refs] index ee9f9152029f..b716523b3044 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ac1d68296b2504cd878e328be21eebb6093b7f27 +refs/heads/master: 6fa780095f058f0960f220754217701a53a9e403 diff --git a/trunk/drivers/infiniband/hw/cxgb3/iwch.h b/trunk/drivers/infiniband/hw/cxgb3/iwch.h index a1c44578e039..837862287a29 100644 --- a/trunk/drivers/infiniband/hw/cxgb3/iwch.h +++ b/trunk/drivers/infiniband/hw/cxgb3/iwch.h @@ -153,19 +153,17 @@ static inline int insert_handle(struct iwch_dev *rhp, struct idr *idr, void *handle, u32 id) { int ret; - int newid; - - do { - if (!idr_pre_get(idr, GFP_KERNEL)) { - return -ENOMEM; - } - spin_lock_irq(&rhp->lock); - ret = idr_get_new_above(idr, handle, id, &newid); - BUG_ON(newid != id); - spin_unlock_irq(&rhp->lock); - } while (ret == -EAGAIN); - - return ret; + + idr_preload(GFP_KERNEL); + spin_lock_irq(&rhp->lock); + + ret = idr_alloc(idr, handle, id, id + 1, GFP_NOWAIT); + + spin_unlock_irq(&rhp->lock); + idr_preload_end(); + + BUG_ON(ret == -ENOSPC); + return ret < 0 ? ret : 0; } static inline void remove_handle(struct iwch_dev *rhp, struct idr *idr, u32 id)