## Automatically generated incremental diff
## From:   linux-2.2.15-pre18
## To:     linux-2.2.15-pre19
## Robot:  $Id: make-incremental-diff,v 1.7 2001/12/04 05:19:54 hpa Exp $

diff -urN linux-2.2.15-pre18/Makefile linux/Makefile
--- linux-2.2.15-pre18/Makefile	Mon Dec  3 22:02:34 2001
+++ linux/Makefile	Mon Dec  3 22:02:41 2001
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 2
 SUBLEVEL = 15
-EXTRAVERSION = pre18
+EXTRAVERSION = pre19
 
 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
 
diff -urN linux-2.2.15-pre18/drivers/char/cyclades.c linux/drivers/char/cyclades.c
--- linux-2.2.15-pre18/drivers/char/cyclades.c	Mon Dec  3 22:02:34 2001
+++ linux/drivers/char/cyclades.c	Mon Dec  3 22:02:41 2001
@@ -1011,6 +1011,7 @@
             (tty->ldisc.write_wakeup)(tty);
         }
         wake_up_interruptible(&tty->write_wait);
+        wake_up_interruptible(&tty->poll_wait);
     }
 #ifdef Z_WAKE
     if (test_and_clear_bit(Cy_EVENT_SHUTDOWN_WAKEUP, &info->event)) {
@@ -4591,6 +4592,7 @@
 	CY_UNLOCK(info, flags);
     }
     wake_up_interruptible(&tty->write_wait);
+    wake_up_interruptible(&tty->poll_wait);
     if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP))
 	&& tty->ldisc.write_wakeup)
 	    (tty->ldisc.write_wakeup)(tty);
diff -urN linux-2.2.15-pre18/drivers/char/dz.c linux/drivers/char/dz.c
--- linux-2.2.15-pre18/drivers/char/dz.c	Wed Aug 25 17:29:47 1999
+++ linux/drivers/char/dz.c	Mon Dec  3 22:02:41 2001
@@ -407,6 +407,7 @@
     if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup)
       (tty->ldisc.write_wakeup) (tty);
     wake_up_interruptible (&tty->write_wait);
+    wake_up_interruptible (&tty->poll_wait);
   }
 }
 
@@ -763,6 +764,7 @@
   sti ();
 
   wake_up_interruptible (&tty->write_wait);
+  wake_up_interruptible (&tty->poll_wait);
 
   if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup)
     (tty->ldisc.write_wakeup)(tty);
diff -urN linux-2.2.15-pre18/drivers/char/epca.c linux/drivers/char/epca.c
--- linux-2.2.15-pre18/drivers/char/epca.c	Tue Mar 16 14:21:51 1999
+++ linux/drivers/char/epca.c	Mon Dec  3 22:02:41 2001
@@ -1225,6 +1225,7 @@
 	restore_flags(flags);
 
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
 
@@ -2445,7 +2446,7 @@
 						  tty->ldisc.write_wakeup)
 						(tty->ldisc.write_wakeup)(tty);
 					wake_up_interruptible(&tty->write_wait);
-
+					wake_up_interruptible(&tty->poll_wait);
 				} /* End if LOWWAIT */
 
 			} /* End LOWTX_IND */
@@ -2465,6 +2466,7 @@
 						(tty->ldisc.write_wakeup)(tty);
 
 					wake_up_interruptible(&tty->write_wait);
+					wake_up_interruptible(&tty->poll_wait);
 
 				} /* End if EMPTYWAIT */
 
diff -urN linux-2.2.15-pre18/drivers/char/esp.c linux/drivers/char/esp.c
--- linux-2.2.15-pre18/drivers/char/esp.c	Sat Oct 31 11:06:21 1998
+++ linux/drivers/char/esp.c	Mon Dec  3 22:02:41 2001
@@ -799,6 +799,7 @@
 		    tty->ldisc.write_wakeup)
 			(tty->ldisc.write_wakeup)(tty);
 		wake_up_interruptible(&tty->write_wait);
+		wake_up_interruptible(&tty->poll_wait);
 	}
 }
 
@@ -1410,6 +1411,7 @@
 	info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
 	sti();
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
diff -urN linux-2.2.15-pre18/drivers/char/generic_serial.c linux/drivers/char/generic_serial.c
--- linux-2.2.15-pre18/drivers/char/generic_serial.c	Mon Dec  3 22:02:34 2001
+++ linux/drivers/char/generic_serial.c	Mon Dec  3 22:02:41 2001
@@ -434,6 +434,7 @@
 	restore_flags(flags);
 
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
@@ -548,6 +549,7 @@
 		    tty->ldisc.write_wakeup)
 			(tty->ldisc.write_wakeup)(tty);
 		wake_up_interruptible(&tty->write_wait);
+		wake_up_interruptible(&tty->poll_wait);
 	}
 	func_exit ();
 }
diff -urN linux-2.2.15-pre18/drivers/char/ip2/i2lib.c linux/drivers/char/ip2/i2lib.c
--- linux-2.2.15-pre18/drivers/char/ip2/i2lib.c	Wed Aug 25 17:29:47 1999
+++ linux/drivers/char/ip2/i2lib.c	Mon Dec  3 22:02:41 2001
@@ -1390,6 +1390,7 @@
 	ip2trace (CHANN, ITRC_SICMD, 10, 2, tp->flags, (1 << TTY_DO_WRITE_WAKEUP) );
 #endif
 	wake_up_interruptible ( &tp->write_wait );
+	wake_up_interruptible ( &tp->poll_wait );
 	if ( ( tp->flags & (1 << TTY_DO_WRITE_WAKEUP) ) 
 	  && tp->ldisc.write_wakeup )
 	{
diff -urN linux-2.2.15-pre18/drivers/char/ip2main.c linux/drivers/char/ip2main.c
--- linux-2.2.15-pre18/drivers/char/ip2main.c	Wed Aug 25 17:29:47 1999
+++ linux/drivers/char/ip2main.c	Mon Dec  3 22:02:41 2001
@@ -1204,6 +1204,7 @@
 				goto skip_this;
 			}
 			wake_up_interruptible(&pCh->pTTY->read_wait);
+			wake_up_interruptible(&pCh->pTTY->poll_wait);
 		}
 #ifdef NEVER_HAPPENS_AS_SETUP_XXX
 	// and can't work because we don't know the_char
diff -urN linux-2.2.15-pre18/drivers/char/isicom.c linux/drivers/char/isicom.c
--- linux-2.2.15-pre18/drivers/char/isicom.c	Wed Aug 25 17:29:47 1999
+++ linux/drivers/char/isicom.c	Mon Dec  3 22:02:41 2001
@@ -532,6 +532,7 @@
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 } 		
  		
 /* main interrupt handler routine */ 		
@@ -1696,6 +1697,7 @@
 	restore_flags(flags);
 	
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
diff -urN linux-2.2.15-pre18/drivers/char/istallion.c linux/drivers/char/istallion.c
--- linux-2.2.15-pre18/drivers/char/istallion.c	Mon Dec  3 22:02:34 2001
+++ linux/drivers/char/istallion.c	Mon Dec  3 22:02:41 2001
@@ -2498,6 +2498,7 @@
 	restore_flags(flags);
 
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
@@ -3034,6 +3035,7 @@
 					EBRDENABLE(brdp);
 				}
 				wake_up_interruptible(&tty->write_wait);
+				wake_up_interruptible(&tty->poll_wait);
 			}
 		}
 
diff -urN linux-2.2.15-pre18/drivers/char/moxa.c linux/drivers/char/moxa.c
--- linux-2.2.15-pre18/drivers/char/moxa.c	Tue Jan  4 10:12:14 2000
+++ linux/drivers/char/moxa.c	Mon Dec  3 22:02:41 2001
@@ -743,6 +743,7 @@
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup) (tty);
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 }
 
 static int moxa_chars_in_buffer(struct tty_struct *tty)
@@ -1000,6 +1001,7 @@
 						  tp->ldisc.write_wakeup)
 							(tp->ldisc.write_wakeup) (tp);
 						wake_up_interruptible(&tp->write_wait);
+						wake_up_interruptible(&tp->poll_wait);
 					}
 				}
 			}
@@ -1190,6 +1192,7 @@
 			    ch->tty->ldisc.write_wakeup)
 				(ch->tty->ldisc.write_wakeup) (ch->tty);
 			wake_up_interruptible(&ch->tty->write_wait);
+			wake_up_interruptible(&ch->tty->poll_wait);
 			return;
 		}
 		moxaEmptyTimer[ch->port].expires = jiffies + HZ;
diff -urN linux-2.2.15-pre18/drivers/char/mxser.c linux/drivers/char/mxser.c
--- linux-2.2.15-pre18/drivers/char/mxser.c	Tue Jan  4 10:12:14 2000
+++ linux/drivers/char/mxser.c	Mon Dec  3 22:02:41 2001
@@ -716,6 +716,7 @@
 		    tty->ldisc.write_wakeup)
 			(tty->ldisc.write_wakeup) (tty);
 		wake_up_interruptible(&tty->write_wait);
+		wake_up_interruptible(&tty->poll_wait);
 	}
 	if (test_and_clear_bit(MXSER_EVENT_HANGUP, &info->event)) {
 		tty_hangup(tty);
@@ -1011,6 +1012,7 @@
 	info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
 	restore_flags(flags);
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup) (tty);
diff -urN linux-2.2.15-pre18/drivers/char/n_hdlc.c linux/drivers/char/n_hdlc.c
--- linux-2.2.15-pre18/drivers/char/n_hdlc.c	Tue Oct 26 17:53:40 1999
+++ linux/drivers/char/n_hdlc.c	Mon Dec  3 22:02:41 2001
@@ -239,6 +239,7 @@
 	/* Queues for select() functionality */
 	wait_queue_head_t read_wait;
 	wait_queue_head_t write_wait;
+	wait_queue_head_t poll_wait;
 
 	int		tbusy;		/* reentrancy flag for tx wakeup code */
 	int		woke_up;
@@ -317,6 +318,7 @@
 		
 	/* Ensure that the n_hdlcd process is not hanging on select()/poll() */
 	wake_up_interruptible (&n_hdlc->read_wait);
+	wake_up_interruptible (&n_hdlc->poll_wait);
 	wake_up_interruptible (&n_hdlc->write_wait);
 
 	if (tty != NULL && tty->disc_data == n_hdlc)
@@ -659,6 +661,7 @@
 	
 	/* wake up any blocked reads and perform async signalling */
 	wake_up_interruptible (&n_hdlc->read_wait);
+	wake_up_interruptible (&n_hdlc->poll_wait);
 	if (n_hdlc->tty->fasync != NULL)
 		kill_fasync (n_hdlc->tty->fasync, SIGIO);
 
@@ -988,13 +991,7 @@
 	if (n_hdlc && n_hdlc->magic == HDLC_MAGIC && tty == n_hdlc->tty) {
 		/* queue current process into any wait queue that */
 		/* may awaken in the future (read and write) */
-#if LINUX_VERSION_CODE < VERSION(2,1,89)
-		poll_wait(&n_hdlc->read_wait, wait);
-		poll_wait(&n_hdlc->write_wait, wait);
-#else
-		poll_wait(filp, &n_hdlc->read_wait, wait);
-		poll_wait(filp, &n_hdlc->write_wait, wait);
-#endif
+		poll_wait(filp, &n_hdlc->poll_wait, wait);
 		/* set bits for operations that wont block */
 		if(n_hdlc->rx_buf_list.head)
 			mask |= POLLIN | POLLRDNORM;	/* readable */
@@ -1057,6 +1054,7 @@
 
 	n_hdlc->flags  = 0;
 	init_waitqueue_head(&n_hdlc->read_wait);
+	init_waitqueue_head(&n_hdlc->poll_wait);
 	init_waitqueue_head(&n_hdlc->write_wait);
 	
 	return n_hdlc;
diff -urN linux-2.2.15-pre18/drivers/char/n_tty.c linux/drivers/char/n_tty.c
--- linux-2.2.15-pre18/drivers/char/n_tty.c	Mon Dec  3 22:02:34 2001
+++ linux/drivers/char/n_tty.c	Mon Dec  3 22:02:41 2001
@@ -122,6 +122,7 @@
 	if (tty->link->packet) {
 		tty->ctrl_status |= TIOCPKT_FLUSHREAD;
 		wake_up_interruptible(&tty->link->read_wait);
+		wake_up_interruptible(&tty->link->poll_wait);
 	}
 }
 
@@ -441,6 +442,7 @@
 	}
 	put_tty_queue('\0', tty);
 	wake_up_interruptible(&tty->read_wait);
+	wake_up_interruptible(&tty->poll_wait);
 }
 
 static inline void n_tty_receive_overrun(struct tty_struct *tty)
@@ -471,6 +473,7 @@
 	else
 		put_tty_queue(c, tty);
 	wake_up_interruptible(&tty->read_wait);
+	wake_up_interruptible(&tty->poll_wait);
 }
 
 static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
@@ -633,8 +636,11 @@
 			tty->canon_data++;
 			if (tty->fasync)
 				kill_fasync(tty->fasync, SIGIO);
-			if (tty->read_wait)
+			if (tty->read_wait || tty->poll_wait)
+			{
 				wake_up_interruptible(&tty->read_wait);
+				wake_up_interruptible(&tty->poll_wait);
+			}
 			return;
 		}
 	}
@@ -738,8 +744,11 @@
 	if (!tty->icanon && (tty->read_cnt >= tty->minimum_to_wake)) {
 		if (tty->fasync)
 			kill_fasync(tty->fasync, SIGIO);
-		if (tty->read_wait)
+		if (tty->read_wait||tty->poll_wait)
+		{
 			wake_up_interruptible(&tty->read_wait);
+			wake_up_interruptible(&tty->poll_wait);
+		}
 	}
 
 	/*
@@ -947,7 +956,7 @@
 		if (minimum) {
 			if (time)
 				tty->minimum_to_wake = 1;
-			else if (!waitqueue_active(&tty->read_wait) ||
+			else if ((!waitqueue_active(&tty->read_wait) && !waitqueue_active(&tty->poll_wait)) ||
 				 (tty->minimum_to_wake > minimum))
 				tty->minimum_to_wake = minimum;
 		} else {
@@ -1079,7 +1088,7 @@
 	up(&tty->atomic_read);
 	remove_wait_queue(&tty->read_wait, &wait);
 
-	if (!waitqueue_active(&tty->read_wait))
+	if (!waitqueue_active(&tty->read_wait) && !waitqueue_active(&tty->poll_wait))
 		tty->minimum_to_wake = minimum;
 
 	current->state = TASK_RUNNING;
@@ -1171,8 +1180,7 @@
 {
 	unsigned int mask = 0;
 
-	poll_wait(file, &tty->read_wait, wait);
-	poll_wait(file, &tty->write_wait, wait);
+	poll_wait(file, &tty->poll_wait, wait);
 	if (input_available_p(tty, TIME_CHAR(tty) ? 0 : MIN_CHAR(tty)))
 		mask |= POLLIN | POLLRDNORM;
 	if (tty->packet && tty->link->ctrl_status)
diff -urN linux-2.2.15-pre18/drivers/char/pcxx.c linux/drivers/char/pcxx.c
--- linux-2.2.15-pre18/drivers/char/pcxx.c	Wed Mar 10 16:51:35 1999
+++ linux/drivers/char/pcxx.c	Mon Dec  3 22:02:41 2001
@@ -869,6 +869,7 @@
 	restore_flags(flags);
 
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
 }
@@ -1748,6 +1749,7 @@
 						tty->ldisc.write_wakeup)
 						(tty->ldisc.write_wakeup)(tty);
 					wake_up_interruptible(&tty->write_wait);
+					wake_up_interruptible(&tty->poll_wait);
 				}
 			}
 
@@ -1759,6 +1761,7 @@
 						tty->ldisc.write_wakeup)
 						(tty->ldisc.write_wakeup)(tty);
 					wake_up_interruptible(&tty->write_wait);
+					wake_up_interruptible(&tty->poll_wait);
 				}
 			}
 		}
diff -urN linux-2.2.15-pre18/drivers/char/pty.c linux/drivers/char/pty.c
--- linux-2.2.15-pre18/drivers/char/pty.c	Mon Dec  3 22:02:34 2001
+++ linux/drivers/char/pty.c	Mon Dec  3 22:02:41 2001
@@ -75,6 +75,7 @@
 			return;
 	}
 	wake_up_interruptible(&tty->read_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	wake_up_interruptible(&tty->write_wait);
 	tty->packet = 0;
 	if (!tty->link)
@@ -82,6 +83,7 @@
 	tty->link->packet = 0;
 	wake_up_interruptible(&tty->link->read_wait);
 	wake_up_interruptible(&tty->link->write_wait);
+	wake_up_interruptible(&tty->link->poll_wait);
 	set_bit(TTY_OTHER_CLOSED, &tty->link->flags);
 	if (tty->driver.subtype == PTY_TYPE_MASTER) {
 		set_bit(TTY_OTHER_CLOSED, &tty->flags);
@@ -296,6 +298,7 @@
 	if (to->packet) {
 		tty->ctrl_status |= TIOCPKT_FLUSHWRITE;
 		wake_up_interruptible(&to->read_wait);
+		wake_up_interruptible(&to->poll_wait);
 	}
 }
 
diff -urN linux-2.2.15-pre18/drivers/char/random.c linux/drivers/char/random.c
--- linux-2.2.15-pre18/drivers/char/random.c	Mon Dec  3 22:02:34 2001
+++ linux/drivers/char/random.c	Mon Dec  3 22:02:41 2001
@@ -425,6 +425,7 @@
 static struct timer_rand_state *irq_timer_state[NR_IRQS];
 static struct timer_rand_state *blkdev_timer_state[MAX_BLKDEV];
 static struct wait_queue *random_read_wait;
+static struct wait_queue *random_poll_wait;
 static struct wait_queue *random_write_wait;
 
 static ssize_t random_read(struct file * file, char * buf,
@@ -556,6 +557,7 @@
 #endif
 	extract_timer_state.dont_count_entropy = 1;
 	random_read_wait = NULL;
+	random_poll_wait = NULL;
 	random_write_wait = NULL;
 }
 
@@ -763,7 +765,10 @@
 
 		/* Wake up waiting processes, if we have enough entropy. */
 		if (r->entropy_count >= WAIT_INPUT_BITS)
+		{
 			wake_up_interruptible(&random_read_wait);
+			wake_up_interruptible(&random_poll_wait);
+		}
 	}
 		
 #ifdef RANDOM_BENCHMARK
@@ -1219,7 +1224,10 @@
 		r->entropy_count = 0;
 
 	if (r->entropy_count < WAIT_OUTPUT_BITS)
+	{
 		wake_up_interruptible(&random_write_wait);
+		wake_up_interruptible(&random_poll_wait);
+	}
 	
 	while (nbytes) {
 		/* Hash the pool to get the output */
@@ -1365,8 +1373,7 @@
 {
 	unsigned int mask;
 
-	poll_wait(file, &random_read_wait, wait);
-	poll_wait(file, &random_write_wait, wait);
+	poll_wait(file, &random_poll_wait, wait);
 	mask = 0;
 	if (random_state.entropy_count >= WAIT_INPUT_BITS)
 		mask |= POLLIN | POLLRDNORM;
@@ -1449,7 +1456,10 @@
 		 * entropy.
 		 */
 		if (random_state.entropy_count >= WAIT_INPUT_BITS)
+		{
 			wake_up_interruptible(&random_read_wait);
+			wake_up_interruptible(&random_poll_wait);
+		}
 		return 0;
 	case RNDGETPOOL:
 		if (!capable(CAP_SYS_ADMIN))
@@ -1502,7 +1512,10 @@
 		 * entropy.
 		 */
 		if (random_state.entropy_count >= WAIT_INPUT_BITS)
+		{
 			wake_up_interruptible(&random_read_wait);
+			wake_up_interruptible(&random_poll_wait);
+		}
 		return 0;
 	case RNDZAPENTCNT:
 		if (!capable(CAP_SYS_ADMIN))
diff -urN linux-2.2.15-pre18/drivers/char/rio/riointr.c linux/drivers/char/rio/riointr.c
--- linux-2.2.15-pre18/drivers/char/rio/riointr.c	Mon Dec  3 22:02:34 2001
+++ linux/drivers/char/rio/riointr.c	Mon Dec  3 22:02:41 2001
@@ -254,6 +254,7 @@
     rio_dprint (RIO_DEBUG_INTR, ("(%d/%d)\n",
 		PortP->gs.wakeup_chars, PortP->gs.xmit_cnt)); 
     wake_up_interruptible(&PortP->gs.tty->write_wait);
+    wake_up_interruptible(&PortP->gs.tty->poll_wait);
   }
 
 }
diff -urN linux-2.2.15-pre18/drivers/char/riscom8.c linux/drivers/char/riscom8.c
--- linux-2.2.15-pre18/drivers/char/riscom8.c	Tue Dec 29 11:29:54 1998
+++ linux/drivers/char/riscom8.c	Mon Dec  3 22:02:41 2001
@@ -1331,6 +1331,7 @@
 	restore_flags(flags);
 	
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
@@ -1713,6 +1714,7 @@
 		    tty->ldisc.write_wakeup)
 			(tty->ldisc.write_wakeup)(tty);
 		wake_up_interruptible(&tty->write_wait);
+		wake_up_interruptible(&tty->poll_wait);
 	}
 }
 
diff -urN linux-2.2.15-pre18/drivers/char/rocket.c linux/drivers/char/rocket.c
--- linux-2.2.15-pre18/drivers/char/rocket.c	Wed Mar 10 16:51:35 1999
+++ linux/drivers/char/rocket.c	Mon Dec  3 22:02:41 2001
@@ -443,6 +443,7 @@
 		    tty->ldisc.write_wakeup)
 			(tty->ldisc.write_wakeup)(tty);
 		wake_up_interruptible(&tty->write_wait);
+		wake_up_interruptible(&tty->poll_wait);
 	}
 #ifdef ROCKET_DEBUG_INTR
 	printk("(%d,%d,%d,%d)...", info->xmit_cnt, info->xmit_head,
@@ -1697,6 +1698,7 @@
 		info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
 		sti();
 		wake_up_interruptible(&tty->write_wait);
+		wake_up_interruptible(&tty->poll_wait);
 		return;
 	}
 	if (info->count) {
diff -urN linux-2.2.15-pre18/drivers/char/serial.c linux/drivers/char/serial.c
--- linux-2.2.15-pre18/drivers/char/serial.c	Mon Dec  3 22:02:34 2001
+++ linux/drivers/char/serial.c	Mon Dec  3 22:02:41 2001
@@ -816,6 +816,7 @@
 		    tty->ldisc.write_wakeup)
 			(tty->ldisc.write_wakeup)(tty);
 		wake_up_interruptible(&tty->write_wait);
+		wake_up_interruptible(&tty->poll_wait);
 	}
 }
 
@@ -1537,6 +1538,7 @@
 	info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
 	restore_flags(flags);
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
diff -urN linux-2.2.15-pre18/drivers/char/serial167.c linux/drivers/char/serial167.c
--- linux-2.2.15-pre18/drivers/char/serial167.c	Thu Nov  5 09:58:43 1998
+++ linux/drivers/char/serial167.c	Mon Dec  3 22:02:41 2001
@@ -775,6 +775,7 @@
 	    (tty->ldisc.write_wakeup)(tty);
 	}
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
     }
 } /* do_softint */
 
@@ -1332,6 +1333,7 @@
 	info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
     restore_flags(flags);
     wake_up_interruptible(&tty->write_wait);
+    wake_up_interruptible(&tty->poll_wait);
     if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP))
     && tty->ldisc.write_wakeup)
 	(tty->ldisc.write_wakeup)(tty);
diff -urN linux-2.2.15-pre18/drivers/char/specialix.c linux/drivers/char/specialix.c
--- linux-2.2.15-pre18/drivers/char/specialix.c	Mon Dec  3 22:02:35 2001
+++ linux/drivers/char/specialix.c	Mon Dec  3 22:02:41 2001
@@ -1733,6 +1733,7 @@
 	restore_flags(flags);
 	
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
@@ -2191,6 +2192,7 @@
 		    tty->ldisc.write_wakeup)
 			(tty->ldisc.write_wakeup)(tty);
 		wake_up_interruptible(&tty->write_wait);
+		wake_up_interruptible(&tty->poll_wait);
 	}
 }
 
diff -urN linux-2.2.15-pre18/drivers/char/stallion.c linux/drivers/char/stallion.c
--- linux-2.2.15-pre18/drivers/char/stallion.c	Mon Dec  3 22:02:35 2001
+++ linux/drivers/char/stallion.c	Mon Dec  3 22:02:41 2001
@@ -1883,6 +1883,7 @@
 
 	stl_flush(portp);
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
@@ -2267,6 +2268,7 @@
 		    tty->ldisc.write_wakeup)
 			(tty->ldisc.write_wakeup)(tty);
 		wake_up_interruptible(&tty->write_wait);
+		wake_up_interruptible(&tty->poll_wait);
 	}
 	if (test_bit(ASYI_DCDCHANGE, &portp->istate)) {
 		clear_bit(ASYI_DCDCHANGE, &portp->istate);
diff -urN linux-2.2.15-pre18/drivers/char/sx.c linux/drivers/char/sx.c
--- linux-2.2.15-pre18/drivers/char/sx.c	Mon Dec  3 22:02:35 2001
+++ linux/drivers/char/sx.c	Mon Dec  3 22:02:41 2001
@@ -1064,6 +1064,7 @@
 		sx_dprintk (SX_DEBUG_TRANSMIT, "Waking up.... ldisc (%d)....\n",
 		            port->gs.wakeup_chars); 
 		wake_up_interruptible(&port->gs.tty->write_wait);
+		wake_up_interruptible(&port->gs.tty->poll_wait);
 	}
 
 	clear_bit (SX_PORT_TRANSMIT_LOCK, &port->locks);
diff -urN linux-2.2.15-pre18/drivers/char/synclink.c linux/drivers/char/synclink.c
--- linux-2.2.15-pre18/drivers/char/synclink.c	Tue Jan  4 10:12:15 2000
+++ linux/drivers/char/synclink.c	Mon Dec  3 22:02:41 2001
@@ -1280,6 +1280,7 @@
 			(tty->ldisc.write_wakeup)(tty);
 		}
 		wake_up_interruptible(&tty->write_wait);
+		wake_up_interruptible(&tty->poll_wait);
 	}
 
 	/* if transmitter idle and loopmode_send_done_requested
@@ -2478,6 +2479,7 @@
 	spin_unlock_irqrestore(&info->irq_spinlock,flags);
 	
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
diff -urN linux-2.2.15-pre18/drivers/char/tty_io.c linux/drivers/char/tty_io.c
--- linux-2.2.15-pre18/drivers/char/tty_io.c	Mon Dec  3 22:02:35 2001
+++ linux/drivers/char/tty_io.c	Mon Dec  3 22:02:41 2001
@@ -434,6 +434,7 @@
 
 	wake_up_interruptible(&tty->write_wait);
 	wake_up_interruptible(&tty->read_wait);
+	wake_up_interruptible(&tty->poll_wait);
 
 	/*
 	 * Shutdown the current line discipline, and reset it to
@@ -574,6 +575,7 @@
 		tty->ctrl_status &= ~TIOCPKT_START;
 		tty->ctrl_status |= TIOCPKT_STOP;
 		wake_up_interruptible(&tty->link->read_wait);
+		wake_up_interruptible(&tty->link->poll_wait);
 	}
 	if (tty->driver.stop)
 		(tty->driver.stop)(tty);
@@ -588,6 +590,7 @@
 		tty->ctrl_status &= ~TIOCPKT_STOP;
 		tty->ctrl_status |= TIOCPKT_START;
 		wake_up_interruptible(&tty->link->read_wait);
+		wake_up_interruptible(&tty->link->poll_wait);
 	}
 	if (tty->driver.start)
 		(tty->driver.start)(tty);
@@ -595,6 +598,7 @@
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 }
 
 static ssize_t tty_read(struct file * file, char * buf, size_t count, 
@@ -1106,6 +1110,10 @@
 				wake_up(&tty->read_wait);
 				do_sleep++;
 			}
+			if (waitqueue_active(&tty->poll_wait)) {
+				wake_up(&tty->poll_wait);
+				do_sleep++;
+			}
 			if (waitqueue_active(&tty->write_wait)) {
 				wake_up(&tty->write_wait);
 				do_sleep++;
@@ -1120,6 +1128,10 @@
 				wake_up(&o_tty->write_wait);
 				do_sleep++;
 			}
+			if (waitqueue_active(&o_tty->poll_wait)) {
+				wake_up(&o_tty->poll_wait);
+				do_sleep++;
+			}
 		}
 		if (!do_sleep)
 			break;
@@ -1448,7 +1460,7 @@
 		return retval;
 
 	if (on) {
-		if (!waitqueue_active(&tty->read_wait))
+		if (!waitqueue_active(&tty->read_wait) && !waitqueue_active(&tty->poll_wait))
 			tty->minimum_to_wake = 1;
 		if (filp->f_owner.pid == 0) {
 			filp->f_owner.pid = (-tty->pgrp) ? : current->pid;
@@ -1456,7 +1468,7 @@
 			filp->f_owner.euid = current->euid;
 		}
 	} else {
-		if (!tty->fasync && !waitqueue_active(&tty->read_wait))
+		if (!tty->fasync && !waitqueue_active(&tty->read_wait) && !waitqueue_active(&tty->poll_wait))
 			tty->minimum_to_wake = N_TTY_BUF_SIZE;
 	}
 	return 0;
diff -urN linux-2.2.15-pre18/drivers/char/tty_ioctl.c linux/drivers/char/tty_ioctl.c
--- linux-2.2.15-pre18/drivers/char/tty_ioctl.c	Tue Jan 19 10:12:05 1999
+++ linux/drivers/char/tty_ioctl.c	Mon Dec  3 22:02:41 2001
@@ -113,8 +113,11 @@
 	}
 	sti();
 	if (canon_change && !L_ICANON(tty) && tty->read_cnt)
+	{
 		/* Get characters left over from canonical mode. */
 		wake_up_interruptible(&tty->read_wait);
+		wake_up_interruptible(&tty->poll_wait);
+	}
 
 	/* see if packet mode change of state */
 
@@ -132,6 +135,7 @@
 			else
 				tty->ctrl_status |= TIOCPKT_NOSTOP;
 			wake_up_interruptible(&tty->link->read_wait);
+			wake_up_interruptible(&tty->link->poll_wait);
 		}
 	}
 
diff -urN linux-2.2.15-pre18/drivers/macintosh/macserial.c linux/drivers/macintosh/macserial.c
--- linux-2.2.15-pre18/drivers/macintosh/macserial.c	Tue Jan  4 10:12:17 2000
+++ linux/drivers/macintosh/macserial.c	Mon Dec  3 22:02:41 2001
@@ -711,6 +711,7 @@
 		    tty->ldisc.write_wakeup)
 			(tty->ldisc.write_wakeup)(tty);
 		wake_up_interruptible(&tty->write_wait);
+		wake_up_interruptible(&tty->poll_wait);
 	}
 }
 
@@ -1487,6 +1488,7 @@
 	info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
 	restore_flags(flags);
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
diff -urN linux-2.2.15-pre18/drivers/sbus/char/aurora.c linux/drivers/sbus/char/aurora.c
--- linux-2.2.15-pre18/drivers/sbus/char/aurora.c	Wed Jun  9 14:43:53 1999
+++ linux/drivers/sbus/char/aurora.c	Mon Dec  3 22:02:41 2001
@@ -1702,6 +1702,7 @@
 	restore_flags(flags);
 	
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
@@ -2197,6 +2198,7 @@
 		    tty->ldisc.write_wakeup)
 			(tty->ldisc.write_wakeup)(tty);
 		wake_up_interruptible(&tty->write_wait);
+		wake_up_interruptible(&tty->poll_wait);
 	}
 #ifdef AURORA_DEBUG
 printk("do_softint: end\n");
diff -urN linux-2.2.15-pre18/drivers/sbus/char/sab82532.c linux/drivers/sbus/char/sab82532.c
--- linux-2.2.15-pre18/drivers/sbus/char/sab82532.c	Tue Jan  4 10:12:19 2000
+++ linux/drivers/sbus/char/sab82532.c	Mon Dec  3 22:02:41 2001
@@ -671,6 +671,7 @@
 		    tty->ldisc.write_wakeup)
 			(tty->ldisc.write_wakeup)(tty);
 		wake_up_interruptible(&tty->write_wait);
+		wake_up_interruptible(&tty->poll_wait);
 	}
 }
 
@@ -1156,6 +1157,7 @@
 	info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
 	sti();
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
diff -urN linux-2.2.15-pre18/drivers/sbus/char/su.c linux/drivers/sbus/char/su.c
--- linux-2.2.15-pre18/drivers/sbus/char/su.c	Tue Jan  4 10:12:19 2000
+++ linux/drivers/sbus/char/su.c	Mon Dec  3 22:02:41 2001
@@ -694,6 +694,7 @@
 		    tty->ldisc.write_wakeup)
 			(tty->ldisc.write_wakeup)(tty);
 		wake_up_interruptible(&tty->write_wait);
+		wake_up_interruptible(&tty->poll_wait);
 	}
 }
 
@@ -1312,6 +1313,7 @@
 	info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
 	restore_flags(flags);
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
diff -urN linux-2.2.15-pre18/drivers/sbus/char/zs.c linux/drivers/sbus/char/zs.c
--- linux-2.2.15-pre18/drivers/sbus/char/zs.c	Mon Dec  3 22:02:35 2001
+++ linux/drivers/sbus/char/zs.c	Mon Dec  3 22:02:41 2001
@@ -737,6 +737,7 @@
 		    tty->ldisc.write_wakeup)
 			(tty->ldisc.write_wakeup)(tty);
 		wake_up_interruptible(&tty->write_wait);
+		wake_up_interruptible(&tty->poll_wait);
 	}
 }
 
@@ -1184,6 +1185,7 @@
 	info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
 	sti();
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
diff -urN linux-2.2.15-pre18/drivers/sound/cmpci.c linux/drivers/sound/cmpci.c
--- linux-2.2.15-pre18/drivers/sound/cmpci.c	Mon Dec  3 22:02:35 2001
+++ linux/drivers/sound/cmpci.c	Mon Dec  3 22:02:42 2001
@@ -272,6 +272,7 @@
 	struct semaphore open_sem;
 	mode_t open_mode;
 	struct wait_queue *open_wait;
+	struct wait_queue *poll_wait;
 
 	struct dmabuf {
 		void *rawbuf;
@@ -303,6 +304,7 @@
 		unsigned ord, owr, ocnt;
 		struct wait_queue *iwait;
 		struct wait_queue *owait;
+		struct wait_queue *pollwait;
 		struct timer_list timer;
 		unsigned char ibuf[MIDIINBUF];
 		unsigned char obuf[MIDIOUTBUF];
@@ -751,7 +753,10 @@
 		if (s->dma_dac.mapped) {
 			s->dma_dac.count += diff;
 			if (s->dma_dac.count >= (signed)s->dma_dac.fragsize)
+			{
 				wake_up(&s->dma_dac.wait);
+				wake_up(&s->poll_wait);
+			}
 		} else {
 			s->dma_dac.count -= diff;
 			if (s->dma_dac.count <= 0) {
@@ -763,7 +768,10 @@
 				s->dma_dac.endcleared = 1;
 			}
 			if (s->dma_dac.count + (signed)s->dma_dac.fragsize <= (signed)s->dma_dac.dmasize)
+			{
 				wake_up(&s->dma_dac.wait);
+				wake_up(&s->poll_wait);
+			}
 		}
 	}
 }
@@ -785,7 +793,10 @@
 		wake = 1;
 	}
 	if (wake)
+	{
 		wake_up(&s->midi.iwait);
+		wake_up(&s->midi.pollwait);
+	}
 	wake = 0;
 	while (!(inb(s->iomidi+1) & 0x40) && s->midi.ocnt > 0) {
 		outb(s->midi.obuf[s->midi.ord], s->iomidi);
@@ -795,7 +806,10 @@
 			wake = 1;
 	}
 	if (wake)
+	{
 		wake_up(&s->midi.owait);
+		wake_up(&s->midi.pollwait);
+	}
 }
 
 static void cm_interrupt(int irq, void *dev_id, struct pt_regs *regs)
@@ -1380,10 +1394,8 @@
 	unsigned int mask = 0;
 
 	VALIDATE_STATE(s);
-	if (file->f_mode & FMODE_WRITE)
-		poll_wait(file, &s->dma_dac.wait, wait);
-	if (file->f_mode & FMODE_READ)
-		poll_wait(file, &s->dma_adc.wait, wait);
+	if (file->f_mode & (FMODE_WRITE|FMODE_READ))
+		poll_wait(file, &s->poll_wait, wait);
 	spin_lock_irqsave(&s->lock, flags);
 	cm_update_ptr(s);
 	if (file->f_mode & FMODE_READ) {
@@ -1955,10 +1967,8 @@
 	unsigned int mask = 0;
 
 	VALIDATE_STATE(s);
-	if (file->f_mode & FMODE_WRITE)
-		poll_wait(file, &s->midi.owait, wait);
-	if (file->f_mode & FMODE_READ)
-		poll_wait(file, &s->midi.iwait, wait);
+	if (file->f_mode & (FMODE_WRITE|FMODE_READ))
+		poll_wait(file, &s->midi.pollwait, wait);
 	spin_lock_irqsave(&s->lock, flags);
 	if (file->f_mode & FMODE_READ) {
 		if (s->midi.icnt > 0)
@@ -2368,10 +2378,12 @@
 		}
 		memset(s, 0, sizeof(struct cm_state));
 		init_waitqueue(&s->dma_adc.wait);
+		init_waitqueue(&s->poll_wait);
 		init_waitqueue(&s->dma_dac.wait);
 		init_waitqueue(&s->open_wait);
 		init_waitqueue(&s->midi.iwait);
 		init_waitqueue(&s->midi.owait);
+		init_waitqueue(&s->midi.pollwait);
 		s->open_sem = MUTEX;
 		s->magic = CM_MAGIC;
 		s->iobase = pcidev->base_address[0] & PCI_BASE_ADDRESS_IO_MASK;
diff -urN linux-2.2.15-pre18/drivers/sound/es1370.c linux/drivers/sound/es1370.c
--- linux-2.2.15-pre18/drivers/sound/es1370.c	Mon Dec  3 22:02:35 2001
+++ linux/drivers/sound/es1370.c	Mon Dec  3 22:02:42 2001
@@ -355,6 +355,7 @@
 	struct semaphore open_sem;
 	mode_t open_mode;
 	wait_queue_head_t open_wait;
+	wait_queue_head_t poll_wait;
 
 	struct dmabuf {
 		void *rawbuf;
@@ -385,6 +386,7 @@
 		unsigned ord, owr, ocnt;
 		wait_queue_head_t iwait;
 		wait_queue_head_t owait;
+		wait_queue_head_t pollwait;
 		unsigned char ibuf[MIDIINBUF];
 		unsigned char obuf[MIDIOUTBUF];
 	} midi;
@@ -671,7 +673,10 @@
 		s->dma_adc.total_bytes += diff;
 		s->dma_adc.count += diff;
 		if (s->dma_adc.count >= (signed)s->dma_adc.fragsize) 
+		{
 			wake_up(&s->dma_adc.wait);
+			wake_up(&s->poll_wait);
+		}
 		if (!s->dma_adc.mapped) {
 			if (s->dma_adc.count > (signed)(s->dma_adc.dmasize - ((3 * s->dma_adc.fragsize) >> 1))) {
 				s->ctrl &= ~CTRL_ADC_EN;
@@ -711,6 +716,7 @@
 			s->dma_dac2.count += diff;
 			if (s->dma_dac2.count >= (signed)s->dma_dac2.fragsize)
 				wake_up(&s->dma_dac2.wait);
+				wake_up(&s->poll_wait);
 		} else {
 			s->dma_dac2.count -= diff;
 			if (s->dma_dac2.count <= 0) {
@@ -723,7 +729,10 @@
 				s->dma_dac2.endcleared = 1;
 			}
 			if (s->dma_dac2.count + (signed)s->dma_dac2.fragsize <= (signed)s->dma_dac2.dmasize)
+			{
 				wake_up(&s->dma_dac2.wait);
+				wake_up(&s->poll_wait);
+			}
 		}
 	}
 }
@@ -747,7 +756,10 @@
 		wake = 1;
 	}
 	if (wake)
+	{
 		wake_up(&s->midi.iwait);
+		wake_up(&s->midi.pollwait);
+	}
 	wake = 0;
 	while ((inb(s->io+ES1370_REG_UART_STATUS) & USTAT_TXRDY) && s->midi.ocnt > 0) {
 		outb(s->midi.obuf[s->midi.ord], s->io+ES1370_REG_UART_DATA);
@@ -757,7 +769,10 @@
 			wake = 1;
 	}
 	if (wake)
+	{
 		wake_up(&s->midi.owait);
+		wake_up(&s->midi.pollwait);
+	}
 	outb((s->midi.ocnt > 0) ? UCTRL_RXINTEN | UCTRL_ENA_TXINT : UCTRL_RXINTEN, s->io+ES1370_REG_UART_CONTROL);
 }
 
@@ -1295,10 +1310,8 @@
 	unsigned int mask = 0;
 
 	VALIDATE_STATE(s);
-	if (file->f_mode & FMODE_WRITE)
-		poll_wait(file, &s->dma_dac2.wait, wait);
-	if (file->f_mode & FMODE_READ)
-		poll_wait(file, &s->dma_adc.wait, wait);
+	if (file->f_mode & (FMODE_READ|FMODE_WRITE))
+		poll_wait(file, &s->poll_wait, wait);
 	spin_lock_irqsave(&s->lock, flags);
 	es1370_update_ptr(s);
 	if (file->f_mode & FMODE_READ) {
@@ -2286,10 +2299,8 @@
 	unsigned int mask = 0;
 
 	VALIDATE_STATE(s);
-	if (file->f_mode & FMODE_WRITE)
-		poll_wait(file, &s->midi.owait, wait);
-	if (file->f_mode & FMODE_READ)
-		poll_wait(file, &s->midi.iwait, wait);
+	if (file->f_mode & (FMODE_WRITE|FMODE_READ))
+		poll_wait(file, &s->midi.pollwait, wait);
 	spin_lock_irqsave(&s->lock, flags);
 	if (file->f_mode & FMODE_READ) {
 		if (s->midi.icnt > 0)
@@ -2478,9 +2489,11 @@
 		}
 		memset(s, 0, sizeof(struct es1370_state));
 		init_waitqueue_head(&s->dma_adc.wait);
+		init_waitqueue_head(&s->poll_wait);
 		init_waitqueue_head(&s->dma_dac1.wait);
 		init_waitqueue_head(&s->dma_dac2.wait);
 		init_waitqueue_head(&s->open_wait);
+		init_waitqueue_head(&s->midi.pollwait);
 		init_waitqueue_head(&s->midi.iwait);
 		init_waitqueue_head(&s->midi.owait);
 		init_MUTEX(&s->open_sem);
diff -urN linux-2.2.15-pre18/drivers/sound/es1371.c linux/drivers/sound/es1371.c
--- linux-2.2.15-pre18/drivers/sound/es1371.c	Mon Dec  3 22:02:35 2001
+++ linux/drivers/sound/es1371.c	Mon Dec  3 22:02:42 2001
@@ -471,6 +471,7 @@
 	struct semaphore open_sem;
 	mode_t open_mode;
 	wait_queue_head_t open_wait;
+	wait_queue_head_t poll_wait;
 
 	struct dmabuf {
 		void *rawbuf;
@@ -501,6 +502,7 @@
 		unsigned ord, owr, ocnt;
 		wait_queue_head_t iwait;
 		wait_queue_head_t owait;
+		wait_queue_head_t pollwait;
 		unsigned char ibuf[MIDIINBUF];
 		unsigned char obuf[MIDIOUTBUF];
 	} midi;
@@ -1046,7 +1048,10 @@
 		s->dma_adc.total_bytes += diff;
 		s->dma_adc.count += diff;
 		if (s->dma_adc.count >= (signed)s->dma_adc.fragsize) 
+		{
 			wake_up(&s->dma_adc.wait);
+			wake_up(&s->poll_wait);
+		}
 		if (!s->dma_adc.mapped) {
 			if (s->dma_adc.count > (signed)(s->dma_adc.dmasize - ((3 * s->dma_adc.fragsize) >> 1))) {
 				s->ctrl &= ~CTRL_ADC_EN;
@@ -1085,7 +1090,10 @@
 		if (s->dma_dac2.mapped) {
 			s->dma_dac2.count += diff;
 			if (s->dma_dac2.count >= (signed)s->dma_dac2.fragsize)
+			{
 				wake_up(&s->dma_dac2.wait);
+				wake_up(&s->poll_wait);
+			}
 		} else {
 			s->dma_dac2.count -= diff;
 			if (s->dma_dac2.count <= 0) {
@@ -1098,7 +1106,10 @@
 				s->dma_dac2.endcleared = 1;
 			}
 			if (s->dma_dac2.count + (signed)s->dma_dac2.fragsize <= (signed)s->dma_dac2.dmasize)
+			{
 				wake_up(&s->dma_dac2.wait);
+				wake_up(&s->poll_wait);
+			}
 		}
 	}
 }
@@ -1122,7 +1133,10 @@
 		wake = 1;
 	}
 	if (wake)
+	{
 		wake_up(&s->midi.iwait);
+		wake_up(&s->midi.pollwait);
+	}
 	wake = 0;
 	while ((inb(s->io+ES1371_REG_UART_STATUS) & USTAT_TXRDY) && s->midi.ocnt > 0) {
 		outb(s->midi.obuf[s->midi.ord], s->io+ES1371_REG_UART_DATA);
@@ -1132,7 +1146,10 @@
 			wake = 1;
 	}
 	if (wake)
+	{
+		wake_up(&s->midi.pollwait);
 		wake_up(&s->midi.owait);
+	}
 	outb((s->midi.ocnt > 0) ? UCTRL_RXINTEN | UCTRL_ENA_TXINT : UCTRL_RXINTEN, s->io+ES1371_REG_UART_CONTROL);
 }
 
@@ -1875,10 +1892,8 @@
 	unsigned int mask = 0;
 
 	VALIDATE_STATE(s);
-	if (file->f_mode & FMODE_WRITE)
-		poll_wait(file, &s->dma_dac2.wait, wait);
-	if (file->f_mode & FMODE_READ)
-		poll_wait(file, &s->dma_adc.wait, wait);
+	if (file->f_mode & (FMODE_WRITE|FMODE_READ))
+		poll_wait(file, &s->poll_wait, wait);
 	spin_lock_irqsave(&s->lock, flags);
 	es1371_update_ptr(s);
 	if (file->f_mode & FMODE_READ) {
@@ -2853,10 +2868,9 @@
 	unsigned int mask = 0;
 
 	VALIDATE_STATE(s);
-	if (file->f_mode & FMODE_WRITE)
-		poll_wait(file, &s->midi.owait, wait);
-	if (file->f_mode & FMODE_READ)
-		poll_wait(file, &s->midi.iwait, wait);
+	if (file->f_mode & (FMODE_WRITE|FMODE_READ))
+		poll_wait(file, &s->midi.pollwait, wait);
+
 	spin_lock_irqsave(&s->lock, flags);
 	if (file->f_mode & FMODE_READ) {
 		if (s->midi.icnt > 0)
@@ -3080,10 +3094,12 @@
 		return -1;
 	}
 	memset(s, 0, sizeof(struct es1371_state));
+	init_waitqueue_head(&s->poll_wait);
 	init_waitqueue_head(&s->dma_adc.wait);
 	init_waitqueue_head(&s->dma_dac1.wait);
 	init_waitqueue_head(&s->dma_dac2.wait);
 	init_waitqueue_head(&s->open_wait);
+	init_waitqueue_head(&s->midi.pollwait);
 	init_waitqueue_head(&s->midi.iwait);
 	init_waitqueue_head(&s->midi.owait);
 	init_MUTEX(&s->open_sem);
diff -urN linux-2.2.15-pre18/drivers/sound/maestro.c linux/drivers/sound/maestro.c
--- linux-2.2.15-pre18/drivers/sound/maestro.c	Mon Dec  3 22:02:35 2001
+++ linux/drivers/sound/maestro.c	Mon Dec  3 22:02:42 2001
@@ -396,6 +396,7 @@
 	/* only let 1 be opening at a time */
 	struct semaphore open_sem;
 	wait_queue_head_t open_wait;
+	wait_queue_head_t poll_wait;
 	mode_t open_mode;
 
 	/* soundcore stuff */
@@ -1815,7 +1816,10 @@
 		s->dma_adc.total_bytes += diff;
 		s->dma_adc.count += diff;
 		if (s->dma_adc.count >= (signed)s->dma_adc.fragsize) 
+		{
 			wake_up(&s->dma_adc.wait);
+			wake_up(&s->poll_wait);
+		}
 		if (!s->dma_adc.mapped) {
 			if (s->dma_adc.count > (signed)(s->dma_adc.dmasize - ((3 * s->dma_adc.fragsize) >> 1))) {
 				/* FILL ME 
@@ -1846,6 +1850,7 @@
 			s->dma_dac.count += diff;
 			if (s->dma_dac.count >= (signed)s->dma_dac.fragsize) {
 				wake_up(&s->dma_dac.wait);
+				wake_up(&s->poll_wait);
 			}
 		} else {
 			s->dma_dac.count -= diff;
@@ -1867,6 +1872,7 @@
 			}
 			if (s->dma_dac.count + (signed)s->dma_dac.fragsize <= (signed)s->dma_dac.dmasize) {
 				wake_up(&s->dma_dac.wait);
+				wake_up(&s->poll_wait);
 /*				printk("waking up DAC count: %d sw: %d hw: %d\n",s->dma_dac.count, s->dma_dac.swptr, 
 					hwptr);*/
 			}
@@ -2403,10 +2409,8 @@
 	unsigned int mask = 0;
 
 	VALIDATE_STATE(s);
-	if (file->f_mode & FMODE_WRITE)
-		poll_wait(file, &s->dma_dac.wait, wait);
-	if (file->f_mode & FMODE_READ)
-		poll_wait(file, &s->dma_adc.wait, wait);
+	if (file->f_mode & (FMODE_WRITE|FMODE_READ))
+		poll_wait(file, &s->poll_wait, wait);
 	spin_lock_irqsave(&s->lock, flags);
 	ess_update_ptr(s);
 	if (file->f_mode & FMODE_READ) {
@@ -3359,6 +3363,7 @@
 		init_waitqueue_head(&s->dma_adc.wait);
 		init_waitqueue_head(&s->dma_dac.wait);
 		init_waitqueue_head(&s->open_wait);
+		init_waitqueue_head(&s->poll_wait);
 		spin_lock_init(&s->lock);
 		SILLY_INIT_SEM(s->open_sem);
 		s->magic = ESS_STATE_MAGIC;
diff -urN linux-2.2.15-pre18/drivers/sound/sonicvibes.c linux/drivers/sound/sonicvibes.c
--- linux-2.2.15-pre18/drivers/sound/sonicvibes.c	Mon Dec  3 22:02:35 2001
+++ linux/drivers/sound/sonicvibes.c	Mon Dec  3 22:02:42 2001
@@ -321,6 +321,7 @@
 	struct semaphore open_sem;
 	mode_t open_mode;
 	wait_queue_head_t open_wait;
+	wait_queue_head_t poll_wait;
 
 	struct dmabuf {
 		void *rawbuf;
@@ -821,7 +822,10 @@
 		s->dma_adc.total_bytes += diff;
 		s->dma_adc.count += diff;
 		if (s->dma_adc.count >= (signed)s->dma_adc.fragsize) 
+		{
 			wake_up(&s->dma_adc.wait);
+			wake_up(&s->poll_wait);
+		}
 		if (!s->dma_adc.mapped) {
 			if (s->dma_adc.count > (signed)(s->dma_adc.dmasize - ((3 * s->dma_adc.fragsize) >> 1))) {
 				s->enable &= ~SV_CENABLE_RE;
@@ -839,7 +843,10 @@
 		if (s->dma_dac.mapped) {
 			s->dma_dac.count += diff;
 			if (s->dma_dac.count >= (signed)s->dma_dac.fragsize)
+			{
 				wake_up(&s->dma_dac.wait);
+				wake_up(&s->poll_wait);
+			}
 		} else {
 			s->dma_dac.count -= diff;
 			if (s->dma_dac.count <= 0) {
@@ -851,7 +858,10 @@
 				s->dma_dac.endcleared = 1;
 			}
 			if (s->dma_dac.count + (signed)s->dma_dac.fragsize <= (signed)s->dma_dac.dmasize)
+			{
 				wake_up(&s->dma_dac.wait);
+				wake_up(&s->poll_wait);
+			}
 		}
 	}
 }
@@ -1489,10 +1499,8 @@
 	unsigned int mask = 0;
 
 	VALIDATE_STATE(s);
-	if (file->f_mode & FMODE_WRITE)
-		poll_wait(file, &s->dma_dac.wait, wait);
-	if (file->f_mode & FMODE_READ)
-		poll_wait(file, &s->dma_adc.wait, wait);
+	if (file->f_mode & (FMODE_WRITE|FMODE_READ))
+		poll_wait(file, &s->poll_wait, wait);
 	spin_lock_irqsave(&s->lock, flags);
 	sv_update_ptr(s);
 	if (file->f_mode & FMODE_READ) {
@@ -2462,6 +2470,7 @@
 		init_waitqueue_head(&s->dma_adc.wait);
 		init_waitqueue_head(&s->dma_dac.wait);
 		init_waitqueue_head(&s->open_wait);
+		init_waitqueue_head(&s->poll_wait);
 		init_waitqueue_head(&s->midi.iwait);
 		init_waitqueue_head(&s->midi.owait);
 		init_MUTEX(&s->open_sem);
diff -urN linux-2.2.15-pre18/include/linux/tty.h linux/include/linux/tty.h
--- linux-2.2.15-pre18/include/linux/tty.h	Mon Dec  3 22:02:35 2001
+++ linux/include/linux/tty.h	Mon Dec  3 22:02:42 2001
@@ -277,6 +277,7 @@
 	int alt_speed;		/* For magic substitution of 38400 bps */
 	struct wait_queue *write_wait;
 	struct wait_queue *read_wait;
+	struct wait_queue *poll_wait;
 	struct tq_struct tq_hangup;
 	void *disc_data;
 	void *driver_data;
diff -urN linux-2.2.15-pre18/masq.patch linux/masq.patch
--- linux-2.2.15-pre18/masq.patch	Mon Dec  3 22:02:35 2001
+++ linux/masq.patch	Wed Dec 31 16:00:00 1969
@@ -1,96 +0,0 @@
-# This is a patch for linux-2.2.15pre16 to update it to linux-2.2.15pre16.masq
-# 
-# To apply this patch:
-# STEP 1: Chdir to the source directory.
-# STEP 2: Run the 'applypatch' program with this patch file as input.
-#
-# If you do not have 'applypatch', it is part of the 'makepatch' package
-# that you can fetch from the Comprehensive Perl Archive Network:
-# http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz
-# In the above URL, 'x' should be 2 or higher.
-#
-# To apply this patch without the use of 'applypatch':
-# STEP 1: Chdir to the source directory.
-# STEP 2: Run the 'patch' program with this file as input.
-#
-#### End of Preamble ####
-
-#### Patch data follows ####
-diff -u 'linux-2.2.15pre16/Documentation/Configure.help' 'linux-2.2.15pre16.masq/Documentation/Configure.help'
-Index: ./Documentation/Configure.help
---- ./Documentation/Configure.help	Fri Mar 31 09:34:45 2000
-+++ ./Documentation/Configure.help	Fri Mar 31 09:50:34 2000
-@@ -2550,6 +2550,20 @@
-   kernel whenever you want; read Documentation/modules.txt for
-   details.
- 
-+IP: UDP masquerading loose checking
-+CONFIG_IP_MASQUERADE_UDP_LOOSE
-+  Whether UDP masquerading does address checking in a loose fashion.
-+
-+  If you say Y here, then UDP masqueraded connections will allow
-+  any external system to be connect back through the firewall to the
-+  port on the internal machine.  However it will allow the more
-+  efficient use of masqueraded ports, and may be required for some
-+  gaming uses.
-+
-+  You should only say Y here if you understand the consequences since
-+  it will open your internal network to external probing and potential
-+  attacks.  In all other cases choose N
-+
- IP: ICMP masquerading
- CONFIG_IP_MASQUERADE_ICMP
-   The basic masquerade code described for "IP: masquerading" above
-diff -u 'linux-2.2.15pre16/net/ipv4/Config.in' 'linux-2.2.15pre16.masq/net/ipv4/Config.in'
-Index: ./net/ipv4/Config.in
---- ./net/ipv4/Config.in	Fri Mar 31 09:34:03 2000
-+++ ./net/ipv4/Config.in	Fri Mar 31 09:52:26 2000
-@@ -41,6 +41,7 @@
-     bool 'IP: masquerading' CONFIG_IP_MASQUERADE
-     if [ "$CONFIG_IP_MASQUERADE" != "n" ]; then
-       comment 'Protocol-specific masquerading support will be built as modules.'
-+      bool 'IP: UDP masquerading loose checking' CONFIG_IP_MASQUERADE_UDP_LOOSE
-       bool 'IP: ICMP masquerading' CONFIG_IP_MASQUERADE_ICMP
-       comment 'Protocol-specific masquerading support will be built as modules.'
-       if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-diff -u 'linux-2.2.15pre16/net/ipv4/ip_masq.c' 'linux-2.2.15pre16.masq/net/ipv4/ip_masq.c'
-Index: ./net/ipv4/ip_masq.c
-Prereq:  1.34.2.2 
---- ./net/ipv4/ip_masq.c	Fri Mar 31 09:34:19 2000
-+++ ./net/ipv4/ip_masq.c	Fri Mar 31 14:38:17 2000
-@@ -412,12 +412,6 @@
- #define MASQ_DPORT_PASS	(IP_MASQ_F_NO_DPORT|IP_MASQ_F_DLOOSE)
- 
- /*
-- *	By default enable dest loose semantics
-- */
--#define CONFIG_IP_MASQ_LOOSE_DEFAULT 1
--
--
--/*
-  * 	Set masq expiration (deletion) and adds timer,
-  *	if timeout==0 cancel expiration.
-  *	Warning: it does not check/delete previous timer!
-@@ -937,7 +931,7 @@
- 	atomic_set(&ms->refcnt,0);
- 
-         if (proto == IPPROTO_UDP && !mport)
--#ifdef CONFIG_IP_MASQ_LOOSE_DEFAULT
-+#ifdef CONFIG_IP_MASQUERADE_UDP_LOOSE
- 		/*
- 		 *	Flag this tunnel as "dest loose"
- 		 *	
-#### End of Patch data ####
-
-#### ApplyPatch data follows ####
-# Data version        : 1.0
-# Date generated      : Fri Mar 31 14:38:26 2000
-# Generated by        : makepatch 2.00
-# Recurse directories : Yes
-# p 'Documentation/Configure.help' 565235 954492634 0100644
-# p 'net/ipv4/Config.in' 3618 954492746 0100644
-# p 'net/ipv4/ip_masq.c' 65999 954509897 0100644
-#### End of ApplyPatch data ####
-
-#### End of Patch kit [created: Fri Mar 31 14:38:26 2000] ####
-#### Checksum: 95 3735 33457 ####
