drm/ttm: Use kref_sub instead of repeatedly calling kref_put

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Thomas Hellstrom
2010-11-16 15:21:08 +01:00
committed by Dave Airlie
parent ecf7ace9a8
commit 2357cbe5f4

View File

@@ -266,10 +266,8 @@ static void ttm_bo_ref_bug(struct kref *list_kref)
void ttm_bo_list_ref_sub(struct ttm_buffer_object *bo, int count, void ttm_bo_list_ref_sub(struct ttm_buffer_object *bo, int count,
bool never_free) bool never_free)
{ {
while (count--) kref_sub(&bo->list_kref, count,
kref_put(&bo->list_kref, (never_free) ? ttm_bo_ref_bug : ttm_bo_release_list);
(never_free || (count >= 0)) ? ttm_bo_ref_bug :
ttm_bo_release_list);
} }
int ttm_bo_reserve(struct ttm_buffer_object *bo, int ttm_bo_reserve(struct ttm_buffer_object *bo,