summaryrefslogtreecommitdiff
path: root/linux-core/drm_vm.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-08-22 11:57:08 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-08-22 11:57:08 +0200
commite201511a0fbeb177a9ecd7f77d177fc88c1616fb (patch)
tree7ad58f0e5264f9da68da9f9838ad1dcf09d6cd57 /linux-core/drm_vm.c
parentca4e34e532e818921f7b2d36fc6886874b7f7924 (diff)
More ttm cleanups.
Diffstat (limited to 'linux-core/drm_vm.c')
-rw-r--r--linux-core/drm_vm.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c
index 9f48f297..85b39490 100644
--- a/linux-core/drm_vm.c
+++ b/linux-core/drm_vm.c
@@ -640,7 +640,7 @@ static int drm_vm_ttm_open(struct vm_area_struct *vma) {
*entry = *tmp_vma;
map = (drm_map_t *) entry->map;
ttm = (drm_ttm_t *) map->offset;
- /* ret = drm_ttm_add_mm_to_list(ttm, vma->vm_mm); */
+ ret = drm_ttm_add_mm_to_list(ttm, vma->vm_mm);
if (!ret) {
atomic_inc(&ttm->vma_count);
INIT_LIST_HEAD(&entry->head);
@@ -706,6 +706,7 @@ static void drm_vm_ttm_close(struct vm_area_struct *vma)
int found_maps;
struct list_head *list;
drm_device_t *dev;
+ int ret;
drm_vm_close(vma);
if (ttm_vma) {
@@ -713,24 +714,15 @@ static void drm_vm_ttm_close(struct vm_area_struct *vma)
ttm = (drm_ttm_t *) map->offset;
dev = ttm->dev;
mutex_lock(&dev->struct_mutex);
- list_del(&ttm_vma->head);
- /* drm_ttm_delete_mm(ttm, vma->vm_mm); */
+ drm_ttm_delete_mm(ttm, vma->vm_mm);
drm_free(ttm_vma, sizeof(*ttm_vma), DRM_MEM_VMAS);
- atomic_dec(&ttm->vma_count);
- found_maps = 0;
- list = NULL;
-#if 0 /* Reimplement with vma_count */
- list_for_each(list, &ttm->owner->ttms) {
- r_list = list_entry(list, drm_map_list_t, head);
- if (r_list->map == map)
- found_maps++;
- }
- if (!found_maps) {
- if (drm_destroy_ttm(ttm) != -EBUSY) {
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
+ if (atomic_dec_and_test(&ttm->vma_count)) {
+ if (ttm->destroy) {
+ ret = drm_destroy_ttm(ttm);
+ BUG_ON(ret);
+ drm_free(map, sizeof(*map), DRM_MEM_TTM);
}
}
-#endif
mutex_unlock(&dev->struct_mutex);
}
return;