patch-2.0.16 linux/include/linux/sched.h

Next file: linux/include/linux/soundcard.h
Previous file: linux/include/linux/isdn.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.15/linux/include/linux/sched.h linux/include/linux/sched.h
@@ -401,12 +401,10 @@
 extern inline void __add_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
 {
 	struct wait_queue *head = *p;
-	struct wait_queue *next = wait;
+	struct wait_queue *next = WAIT_QUEUE_HEAD(p);
 
-	if (head) {
-		next = head->next;
-		p = &head->next;
-	}
+	if (head)
+		next = head;
 	*p = wait;
 	wait->next = next;
 }
@@ -424,22 +422,15 @@
 extern inline void __remove_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
 {
 	struct wait_queue * next = wait->next;
+	struct wait_queue * head = next;
 
-	if (wait == next) {
-		*p = NULL;
-	} else {
-		struct wait_queue *head = *p;
-		if (head == wait)
-			*p = next;
-		for (;;) {
-			struct wait_queue *nextlist = head->next;
-			if (nextlist == wait)
-				break;
-			head = nextlist;
-		}
-		head->next = next;
+	for (;;) {
+		struct wait_queue * nextlist = head->next;
+		if (nextlist == wait)
+			break;
+		head = nextlist;
 	}
-	wait->next = NULL;
+	head->next = next;
 }
 
 extern inline void remove_wait_queue(struct wait_queue ** p, struct wait_queue * wait)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov