staging: tidspbridge: make sync_wait_on_event interruptible
authorGuzman Lugo, Fernando <x0095840@ti.com>
Tue, 26 Oct 2010 00:51:46 +0000 (00:51 +0000)
committerOmar Ramirez Luna <omar.ramirez@ti.com>
Sat, 5 Feb 2011 02:11:08 +0000 (20:11 -0600)
So that avoid non-killable process.

Signed-off-by: Fernando Guzman Lugo <x0095840@ti.com>
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
drivers/staging/tidspbridge/include/dspbridge/sync.h

index e2651e7b1c4288bde442cc89ccfcc73e5e5e61e3..df05b8f8e230e3c69897b38eee08fe0b72d32408 100644 (file)
@@ -80,13 +80,22 @@ void sync_set_event(struct sync_object *event);
  * This functios will wait until @event is set or until timeout. In case of
  * success the function will return 0 and
  * in case of timeout the function will return -ETIME
+ * in case of signal the function will return -ERESTARTSYS
  */
 
 static inline int sync_wait_on_event(struct sync_object *event,
                                                        unsigned timeout)
 {
-       return wait_for_completion_timeout(&event->comp,
-               msecs_to_jiffies(timeout)) ? 0 : -ETIME;
+       int res;
+
+       res = wait_for_completion_interruptible_timeout(&event->comp,
+                                               msecs_to_jiffies(timeout));
+       if (!res)
+               res = -ETIME;
+       else if (res > 0)
+               res = 0;
+
+       return res;
 }
 
 /**