drm/nouveau: set TASK_(UN)INTERRUPTIBLE before schedule_timeout()
authorKulikov Vasiliy <segooon@gmail.com>
Mon, 26 Jul 2010 08:23:54 +0000 (12:23 +0400)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 2 Aug 2010 00:12:26 +0000 (10:12 +1000)
set_current_state() is called only once before the first iteration.
After return from schedule_timeout() current state is TASK_RUNNING. If
we are going to wait again, set_current_state() must be called.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_fence.c

index 813d853b741b31ad4ba1a242d501ce23cce264ae..6b208ffafa8de1df0bdd5dd6ff6aede30f929341 100644 (file)
@@ -186,8 +186,6 @@ nouveau_fence_wait(void *sync_obj, void *sync_arg, bool lazy, bool intr)
        unsigned long timeout = jiffies + (3 * DRM_HZ);
        int ret = 0;
 
-       __set_current_state(intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
-
        while (1) {
                if (nouveau_fence_signalled(sync_obj, sync_arg))
                        break;
@@ -197,6 +195,8 @@ nouveau_fence_wait(void *sync_obj, void *sync_arg, bool lazy, bool intr)
                        break;
                }
 
+               __set_current_state(intr ? TASK_INTERRUPTIBLE
+                       : TASK_UNINTERRUPTIBLE);
                if (lazy)
                        schedule_timeout(1);