Index: include/linux/sched.h
===================================================================
RCS file: /var/cvs/comedi/include/linux/sched.h,v
retrieving revision 1.5
diff -u -r1.5 sched.h
--- include/linux/sched.h	5 Feb 2005 15:22:01 -0000	1.5
+++ include/linux/sched.h	7 Feb 2005 16:31:58 -0000
@@ -11,6 +11,62 @@
 #define signal_pending(x)	(((x)->signal) & (~(x)->blocked))
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,3)
+#define __wait_event(wq, condition) 					\
+do {									\
+	struct wait_queue __wait;					\
+									\
+	__wait.task = current;						\
+	add_wait_queue(&wq, &__wait);					\
+	for (;;) {							\
+		current->state = TASK_UNINTERRUPTIBLE;			\
+		mb();							\
+		if (condition)						\
+			break;						\
+		schedule();						\
+	}								\
+	current->state = TASK_RUNNING;					\
+	remove_wait_queue(&wq, &__wait);				\
+} while (0)
+
+#define wait_event(wq, condition) 					\
+do {									\
+	if (condition)	 						\
+		break;							\
+	__wait_event(wq, condition);					\
+} while (0)
+
+#define __wait_event_interruptible(wq, condition, ret)			\
+do {									\
+	struct wait_queue __wait;					\
+									\
+	__wait.task = current;						\
+	add_wait_queue(&wq, &__wait);					\
+	for (;;) {							\
+		current->state = TASK_INTERRUPTIBLE;			\
+		mb();							\
+		if (condition)						\
+			break;						\
+		if (!signal_pending(current)) {				\
+			schedule();					\
+			continue;					\
+		}							\
+		ret = -ERESTARTSYS;					\
+		break;							\
+	}								\
+	current->state = TASK_RUNNING;					\
+	remove_wait_queue(&wq, &__wait);				\
+} while (0)
+	
+#define wait_event_interruptible(wq, condition)				\
+({									\
+	int __ret = 0;							\
+	if (!(condition))						\
+		__wait_event_interruptible(wq, condition, __ret);	\
+	__ret;								\
+})
+#endif
+
 #include_next <linux/sched.h>
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)

