summaryrefslogtreecommitdiff
path: root/linux-core/drm_os_linux.h
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2005-03-27 07:05:28 +0000
committerDave Airlie <airlied@linux.ie>2005-03-27 07:05:28 +0000
commitc6161eff86b250f3113791edcc162dc97322c401 (patch)
tree7673ad0cfbf80f0ef298fd382d2d58793a400c18 /linux-core/drm_os_linux.h
parent385f927692beb395ae3866538b2b0f8f8e436eba (diff)
Description: Rather than use custom code in DRM_WAIT_ON() to do exactly
what wait_event_interruptible_timeout() does, use the function and just change the return values appropriately. Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Diffstat (limited to 'linux-core/drm_os_linux.h')
-rw-r--r--linux-core/drm_os_linux.h27
1 files changed, 7 insertions, 20 deletions
diff --git a/linux-core/drm_os_linux.h b/linux-core/drm_os_linux.h
index 1ed1cca4..5d5d6e0e 100644
--- a/linux-core/drm_os_linux.h
+++ b/linux-core/drm_os_linux.h
@@ -5,6 +5,7 @@
#include <linux/interrupt.h> /* For task queue support */
#include <linux/delay.h>
+#include <linux/wait.h>
/** File pointer type */
#define DRMFILE struct file *
@@ -145,26 +146,12 @@ do { \
#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
do { \
- DECLARE_WAITQUEUE(entry, current); \
- unsigned long end = jiffies + (timeout); \
- add_wait_queue(&(queue), &entry); \
- \
- for (;;) { \
- __set_current_state(TASK_INTERRUPTIBLE); \
- if (condition) \
- break; \
- if (time_after_eq(jiffies, end)) { \
- ret = -EBUSY; \
- break; \
- } \
- schedule_timeout((HZ/100 > 1) ? HZ/100 : 1); \
- if (signal_pending(current)) { \
- ret = -EINTR; \
- break; \
- } \
- } \
- __set_current_state(TASK_RUNNING); \
- remove_wait_queue(&(queue), &entry); \
+ long __ret; \
+ __ret = wait_event_interruptible_timeout(queue, condition, timeout); \
+ if (__ret == 0) \
+ ret = -EBUSY; \
+ else if (__ret == -ERESTARTSYS) \
+ ret = -EINTR; \
} while (0)
#define DRM_WAKEUP( queue ) wake_up_interruptible( queue )