diff options
author | Tejun Heo <tj@kernel.org> | 2013-02-27 20:04:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-27 22:10:16 -0500 |
commit | cc39a8faedc936df90cac077b2da6f420a777259 (patch) | |
tree | f226cc9cda2be4c5badd493636a8b6d0f6331b6a | |
parent | 36888db24765478a463ac6f443b175ad885dee25 (diff) |
drm/vmwgfx: convert to idr_alloc()
Convert to the much saner new idr interface.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: David Airlie <airlied@linux.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 16556170fb32..bc784254e78e 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |||
@@ -177,17 +177,16 @@ int vmw_resource_alloc_id(struct vmw_resource *res) | |||
177 | 177 | ||
178 | BUG_ON(res->id != -1); | 178 | BUG_ON(res->id != -1); |
179 | 179 | ||
180 | do { | 180 | idr_preload(GFP_KERNEL); |
181 | if (unlikely(idr_pre_get(idr, GFP_KERNEL) == 0)) | 181 | write_lock(&dev_priv->resource_lock); |
182 | return -ENOMEM; | ||
183 | |||
184 | write_lock(&dev_priv->resource_lock); | ||
185 | ret = idr_get_new_above(idr, res, 1, &res->id); | ||
186 | write_unlock(&dev_priv->resource_lock); | ||
187 | 182 | ||
188 | } while (ret == -EAGAIN); | 183 | ret = idr_alloc(idr, res, 1, 0, GFP_NOWAIT); |
184 | if (ret >= 0) | ||
185 | res->id = ret; | ||
189 | 186 | ||
190 | return ret; | 187 | write_unlock(&dev_priv->resource_lock); |
188 | idr_preload_end(); | ||
189 | return ret < 0 ? ret : 0; | ||
191 | } | 190 | } |
192 | 191 | ||
193 | /** | 192 | /** |