summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem_batch_pool.c
diff options
context:
space:
mode:
authorChris Wilson2016-07-26 13:01:53 +0200
committerChris Wilson2016-07-26 14:01:00 +0200
commitf67cbce0f18299b70da776a5d699125b06523700 (patch)
tree68f0eb746a3f94f901a29c9d45f80cc742f06eb4 /drivers/gpu/drm/i915/i915_gem_batch_pool.c
parentdrm/i915: Only clear the client pointer when tearing down the file (diff)
downloadkernel-qcow2-linux-f67cbce0f18299b70da776a5d699125b06523700.tar.gz
kernel-qcow2-linux-f67cbce0f18299b70da776a5d699125b06523700.tar.xz
kernel-qcow2-linux-f67cbce0f18299b70da776a5d699125b06523700.zip
drm/i915: Only drop the batch-pool's object reference
The obj->batch_pool_link is only inspected when traversing the batch pool list and when on the batch pool list the object is referenced. Thus when freeing the batch pool list, we only need to unreference the object and do not have to worry about the obj->batch_pool_link. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: http://patchwork.freedesktop.org/patch/msgid/1469432687-22756-5-git-send-email-chris@chris-wilson.co.uk Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1469530913-17180-4-git-send-email-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_batch_pool.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem_batch_pool.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_batch_pool.c b/drivers/gpu/drm/i915/i915_gem_batch_pool.c
index 3507b2753fd3..825981b5aa40 100644
--- a/drivers/gpu/drm/i915/i915_gem_batch_pool.c
+++ b/drivers/gpu/drm/i915/i915_gem_batch_pool.c
@@ -68,15 +68,14 @@ void i915_gem_batch_pool_fini(struct i915_gem_batch_pool *pool)
WARN_ON(!mutex_is_locked(&pool->dev->struct_mutex));
for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++) {
- while (!list_empty(&pool->cache_list[n])) {
- struct drm_i915_gem_object *obj =
- list_first_entry(&pool->cache_list[n],
- struct drm_i915_gem_object,
- batch_pool_link);
+ struct drm_i915_gem_object *obj, *next;
- list_del(&obj->batch_pool_link);
+ list_for_each_entry_safe(obj, next,
+ &pool->cache_list[n],
+ batch_pool_link)
i915_gem_object_put(obj);
- }
+
+ INIT_LIST_HEAD(&pool->cache_list[n]);
}
}