diff options
Diffstat (limited to 'drivers/gpu/drm/drm_syncobj.c')
-rw-r--r-- | drivers/gpu/drm/drm_syncobj.c | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index e254f97fed7d..5bcb3ef9b256 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c | |||
@@ -672,7 +672,6 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, | |||
672 | { | 672 | { |
673 | struct syncobj_wait_entry *entries; | 673 | struct syncobj_wait_entry *entries; |
674 | struct dma_fence *fence; | 674 | struct dma_fence *fence; |
675 | signed long ret; | ||
676 | uint32_t signaled_count, i; | 675 | uint32_t signaled_count, i; |
677 | 676 | ||
678 | entries = kcalloc(count, sizeof(*entries), GFP_KERNEL); | 677 | entries = kcalloc(count, sizeof(*entries), GFP_KERNEL); |
@@ -692,7 +691,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, | |||
692 | if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { | 691 | if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { |
693 | continue; | 692 | continue; |
694 | } else { | 693 | } else { |
695 | ret = -EINVAL; | 694 | timeout = -EINVAL; |
696 | goto cleanup_entries; | 695 | goto cleanup_entries; |
697 | } | 696 | } |
698 | } | 697 | } |
@@ -704,12 +703,6 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, | |||
704 | } | 703 | } |
705 | } | 704 | } |
706 | 705 | ||
707 | /* Initialize ret to the max of timeout and 1. That way, the | ||
708 | * default return value indicates a successful wait and not a | ||
709 | * timeout. | ||
710 | */ | ||
711 | ret = max_t(signed long, timeout, 1); | ||
712 | |||
713 | if (signaled_count == count || | 706 | if (signaled_count == count || |
714 | (signaled_count > 0 && | 707 | (signaled_count > 0 && |
715 | !(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL))) | 708 | !(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL))) |
@@ -760,18 +753,17 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, | |||
760 | goto done_waiting; | 753 | goto done_waiting; |
761 | 754 | ||
762 | if (timeout == 0) { | 755 | if (timeout == 0) { |
763 | /* If we are doing a 0 timeout wait and we got | 756 | timeout = -ETIME; |
764 | * here, then we just timed out. | ||
765 | */ | ||
766 | ret = 0; | ||
767 | goto done_waiting; | 757 | goto done_waiting; |
768 | } | 758 | } |
769 | 759 | ||
770 | ret = schedule_timeout(ret); | 760 | if (signal_pending(current)) { |
761 | timeout = -ERESTARTSYS; | ||
762 | goto done_waiting; | ||
763 | } | ||
771 | 764 | ||
772 | if (ret > 0 && signal_pending(current)) | 765 | timeout = schedule_timeout(timeout); |
773 | ret = -ERESTARTSYS; | 766 | } while (1); |
774 | } while (ret > 0); | ||
775 | 767 | ||
776 | done_waiting: | 768 | done_waiting: |
777 | __set_current_state(TASK_RUNNING); | 769 | __set_current_state(TASK_RUNNING); |
@@ -788,7 +780,7 @@ cleanup_entries: | |||
788 | } | 780 | } |
789 | kfree(entries); | 781 | kfree(entries); |
790 | 782 | ||
791 | return ret; | 783 | return timeout; |
792 | } | 784 | } |
793 | 785 | ||
794 | /** | 786 | /** |
@@ -829,19 +821,16 @@ static int drm_syncobj_array_wait(struct drm_device *dev, | |||
829 | struct drm_syncobj **syncobjs) | 821 | struct drm_syncobj **syncobjs) |
830 | { | 822 | { |
831 | signed long timeout = drm_timeout_abs_to_jiffies(wait->timeout_nsec); | 823 | signed long timeout = drm_timeout_abs_to_jiffies(wait->timeout_nsec); |
832 | signed long ret = 0; | ||
833 | uint32_t first = ~0; | 824 | uint32_t first = ~0; |
834 | 825 | ||
835 | ret = drm_syncobj_array_wait_timeout(syncobjs, | 826 | timeout = drm_syncobj_array_wait_timeout(syncobjs, |
836 | wait->count_handles, | 827 | wait->count_handles, |
837 | wait->flags, | 828 | wait->flags, |
838 | timeout, &first); | 829 | timeout, &first); |
839 | if (ret < 0) | 830 | if (timeout < 0) |
840 | return ret; | 831 | return timeout; |
841 | 832 | ||
842 | wait->first_signaled = first; | 833 | wait->first_signaled = first; |
843 | if (ret == 0) | ||
844 | return -ETIME; | ||
845 | return 0; | 834 | return 0; |
846 | } | 835 | } |
847 | 836 | ||