aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm/ttm_bo.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_bo.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 60d8179a8bcd..640fb265dd5a 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -125,7 +125,7 @@ int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo, bool interruptible)
125 ret = wait_event_interruptible(bo->event_queue, 125 ret = wait_event_interruptible(bo->event_queue,
126 atomic_read(&bo->reserved) == 0); 126 atomic_read(&bo->reserved) == 0);
127 if (unlikely(ret != 0)) 127 if (unlikely(ret != 0))
128 return -ERESTART; 128 return ret;
129 } else { 129 } else {
130 wait_event(bo->event_queue, atomic_read(&bo->reserved) == 0); 130 wait_event(bo->event_queue, atomic_read(&bo->reserved) == 0);
131 } 131 }
@@ -571,7 +571,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible,
571 spin_unlock(&bo->lock); 571 spin_unlock(&bo->lock);
572 572
573 if (unlikely(ret != 0)) { 573 if (unlikely(ret != 0)) {
574 if (ret != -ERESTART) { 574 if (ret != -ERESTARTSYS) {
575 printk(KERN_ERR TTM_PFX 575 printk(KERN_ERR TTM_PFX
576 "Failed to expire sync object before " 576 "Failed to expire sync object before "
577 "buffer eviction.\n"); 577 "buffer eviction.\n");
@@ -588,7 +588,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible,
588 ret = ttm_bo_mem_space(bo, &placement, &evict_mem, interruptible, 588 ret = ttm_bo_mem_space(bo, &placement, &evict_mem, interruptible,
589 no_wait); 589 no_wait);
590 if (ret) { 590 if (ret) {
591 if (ret != -ERESTART) 591 if (ret != -ERESTARTSYS)
592 printk(KERN_ERR TTM_PFX 592 printk(KERN_ERR TTM_PFX
593 "Failed to find memory space for " 593 "Failed to find memory space for "
594 "buffer 0x%p eviction.\n", bo); 594 "buffer 0x%p eviction.\n", bo);
@@ -598,7 +598,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible,
598 ret = ttm_bo_handle_move_mem(bo, &evict_mem, true, interruptible, 598 ret = ttm_bo_handle_move_mem(bo, &evict_mem, true, interruptible,
599 no_wait); 599 no_wait);
600 if (ret) { 600 if (ret) {
601 if (ret != -ERESTART) 601 if (ret != -ERESTARTSYS)
602 printk(KERN_ERR TTM_PFX "Buffer eviction failed\n"); 602 printk(KERN_ERR TTM_PFX "Buffer eviction failed\n");
603 spin_lock(&glob->lru_lock); 603 spin_lock(&glob->lru_lock);
604 if (evict_mem.mm_node) { 604 if (evict_mem.mm_node) {
@@ -795,7 +795,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
795 uint32_t cur_flags = 0; 795 uint32_t cur_flags = 0;
796 bool type_found = false; 796 bool type_found = false;
797 bool type_ok = false; 797 bool type_ok = false;
798 bool has_eagain = false; 798 bool has_erestartsys = false;
799 struct drm_mm_node *node = NULL; 799 struct drm_mm_node *node = NULL;
800 int i, ret; 800 int i, ret;
801 801
@@ -882,28 +882,21 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
882 mem->mm_node->private = bo; 882 mem->mm_node->private = bo;
883 return 0; 883 return 0;
884 } 884 }
885 if (ret == -ERESTART) 885 if (ret == -ERESTARTSYS)
886 has_eagain = true; 886 has_erestartsys = true;
887 } 887 }
888 ret = (has_eagain) ? -ERESTART : -ENOMEM; 888 ret = (has_erestartsys) ? -ERESTARTSYS : -ENOMEM;
889 return ret; 889 return ret;
890} 890}
891EXPORT_SYMBOL(ttm_bo_mem_space); 891EXPORT_SYMBOL(ttm_bo_mem_space);
892 892
893int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait) 893int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait)
894{ 894{
895 int ret = 0;
896
897 if ((atomic_read(&bo->cpu_writers) > 0) && no_wait) 895 if ((atomic_read(&bo->cpu_writers) > 0) && no_wait)
898 return -EBUSY; 896 return -EBUSY;
899 897
900 ret = wait_event_interruptible(bo->event_queue, 898 return wait_event_interruptible(bo->event_queue,
901 atomic_read(&bo->cpu_writers) == 0); 899 atomic_read(&bo->cpu_writers) == 0);
902
903 if (ret == -ERESTARTSYS)
904 ret = -ERESTART;
905
906 return ret;
907} 900}
908 901
909int ttm_bo_move_buffer(struct ttm_buffer_object *bo, 902int ttm_bo_move_buffer(struct ttm_buffer_object *bo,
@@ -1673,7 +1666,7 @@ int ttm_bo_block_reservation(struct ttm_buffer_object *bo, bool interruptible,
1673 ret = wait_event_interruptible 1666 ret = wait_event_interruptible
1674 (bo->event_queue, atomic_read(&bo->reserved) == 0); 1667 (bo->event_queue, atomic_read(&bo->reserved) == 0);
1675 if (unlikely(ret != 0)) 1668 if (unlikely(ret != 0))
1676 return -ERESTART; 1669 return ret;
1677 } else { 1670 } else {
1678 wait_event(bo->event_queue, 1671 wait_event(bo->event_queue,
1679 atomic_read(&bo->reserved) == 0); 1672 atomic_read(&bo->reserved) == 0);