aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem_context.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-06-19 14:27:39 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-06-20 05:16:48 -0400
commit73c273eb7547d2557b49f9d1f42e298145c1e635 (patch)
tree11152b2746b8735d86b84acf319c246d68392fc8 /drivers/gpu/drm/i915/i915_gem_context.c
parent6f4c45c12c6775b8158fc143115037d084df12c3 (diff)
drm/i915: simplify context_idr_cleanup
The idr code already passes us the pointer associated with that id, so no need to look it up again. Also, we'll kill the idr right away, so there's no issue with leaving these dangling pointers behind - the current code does the same. v2: Also drop the file argument, spotted by Ben Widawsky. Reviewed-by: Ben Widawsky <ben@bwidawsk.net> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_context.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem_context.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index a52fd21e480..1b5041c5256 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -289,14 +289,9 @@ void i915_gem_context_fini(struct drm_device *dev)
289 289
290static int context_idr_cleanup(int id, void *p, void *data) 290static int context_idr_cleanup(int id, void *p, void *data)
291{ 291{
292 struct drm_file *file = (struct drm_file *)data; 292 struct i915_hw_context *ctx = p;
293 struct drm_i915_file_private *file_priv = file->driver_priv;
294 struct i915_hw_context *ctx;
295 293
296 BUG_ON(id == DEFAULT_CONTEXT_ID); 294 BUG_ON(id == DEFAULT_CONTEXT_ID);
297 ctx = i915_gem_context_get(file_priv, id);
298 if (WARN_ON(ctx == NULL))
299 return -ENXIO;
300 295
301 do_destroy(ctx); 296 do_destroy(ctx);
302 297
@@ -308,7 +303,7 @@ void i915_gem_context_close(struct drm_device *dev, struct drm_file *file)
308 struct drm_i915_file_private *file_priv = file->driver_priv; 303 struct drm_i915_file_private *file_priv = file->driver_priv;
309 304
310 mutex_lock(&dev->struct_mutex); 305 mutex_lock(&dev->struct_mutex);
311 idr_for_each(&file_priv->context_idr, context_idr_cleanup, file); 306 idr_for_each(&file_priv->context_idr, context_idr_cleanup, NULL);
312 idr_destroy(&file_priv->context_idr); 307 idr_destroy(&file_priv->context_idr);
313 mutex_unlock(&dev->struct_mutex); 308 mutex_unlock(&dev->struct_mutex);
314} 309}