From: Alan Cox Date: Fri, 23 Nov 2007 20:21:10 +0000 (-0500) Subject: Import 2.2.15pre19 X-Git-Tag: 2.2.15pre19 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=c9cc60f4f7a69bc6318b2bb3d480f2e9219bb61d;p=history.git Import 2.2.15pre19 --- diff --git a/Makefile b/Makefile index d9a9a9c635f6..8e63a7c2d0c8 100644 --- a/Makefile +++ b/Makefile @@ -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 --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index eba36b4c4fab..3d4cec56ca80 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c @@ -1011,6 +1011,7 @@ do_softint(void *private_) (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_flush_buffer(struct tty_struct *tty) 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 --git a/drivers/char/dz.c b/drivers/char/dz.c index 30f28280b7ad..fecae4d9f3ee 100644 --- a/drivers/char/dz.c +++ b/drivers/char/dz.c @@ -407,6 +407,7 @@ static void do_softint (void *private_data) 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 @@ static void dz_flush_buffer (struct tty_struct *tty) 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 --git a/drivers/char/epca.c b/drivers/char/epca.c index e1d2cd2f700f..a5f458e30c45 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c @@ -1225,6 +1225,7 @@ static void pc_flush_buffer(struct tty_struct *tty) 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 @@ static void doevent(int crd) 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 @@ static void doevent(int crd) (tty->ldisc.write_wakeup)(tty); wake_up_interruptible(&tty->write_wait); + wake_up_interruptible(&tty->poll_wait); } /* End if EMPTYWAIT */ diff --git a/drivers/char/esp.c b/drivers/char/esp.c index bf852fb20308..3c7460cdd799 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c @@ -799,6 +799,7 @@ static void do_softint(void *private_) 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 @@ static void rs_flush_buffer(struct tty_struct *tty) 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 --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c index a4c3251aaed8..a10a0fce5e8b 100644 --- a/drivers/char/generic_serial.c +++ b/drivers/char/generic_serial.c @@ -434,6 +434,7 @@ void gs_flush_buffer(struct tty_struct *tty) 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 @@ void gs_do_softint(void *private_) tty->ldisc.write_wakeup) (tty->ldisc.write_wakeup)(tty); wake_up_interruptible(&tty->write_wait); + wake_up_interruptible(&tty->poll_wait); } func_exit (); } diff --git a/drivers/char/ip2/i2lib.c b/drivers/char/ip2/i2lib.c index f8d6f3b169b2..efe152484b05 100644 --- a/drivers/char/ip2/i2lib.c +++ b/drivers/char/ip2/i2lib.c @@ -1390,6 +1390,7 @@ ip2_owake( PTTY tp) 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 --git a/drivers/char/ip2main.c b/drivers/char/ip2main.c index 77e0f95af802..e6574597be7d 100644 --- a/drivers/char/ip2main.c +++ b/drivers/char/ip2main.c @@ -1204,6 +1204,7 @@ do_status( i2ChanStrPtr pCh ) 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 --git a/drivers/char/isicom.c b/drivers/char/isicom.c index d31b73606518..3d65abe8e936 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c @@ -532,6 +532,7 @@ static void isicom_bottomhalf(void * data) 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 @@ static void isicom_flush_buffer(struct tty_struct * tty) 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 --git a/drivers/char/istallion.c b/drivers/char/istallion.c index afeb8e09e5d9..ae2d2c9cc346 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c @@ -2498,6 +2498,7 @@ static void stli_flushbuffer(struct tty_struct *tty) 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 @@ static inline int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) EBRDENABLE(brdp); } wake_up_interruptible(&tty->write_wait); + wake_up_interruptible(&tty->poll_wait); } } diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index b99e2b0cec84..0e7376ee7aea 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c @@ -743,6 +743,7 @@ static void moxa_flush_buffer(struct tty_struct *tty) 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 @@ static void moxa_poll(unsigned long ignored) 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 @@ static void check_xmit_empty(unsigned long data) 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 --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 74a3da523c5e..322e7036889c 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c @@ -716,6 +716,7 @@ static void mxser_do_softint(void *private_) 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 @@ static void mxser_flush_buffer(struct tty_struct *tty) 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 --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c index 0c5d2bcdc2e8..361a4b60ba7c 100644 --- a/drivers/char/n_hdlc.c +++ b/drivers/char/n_hdlc.c @@ -239,6 +239,7 @@ struct n_hdlc { /* 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 @@ static void n_hdlc_release (struct n_hdlc *n_hdlc) /* 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 @@ static void n_hdlc_tty_receive(struct tty_struct *tty, /* 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 @@ static unsigned int n_hdlc_tty_poll (struct tty_struct *tty, 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 @@ static struct n_hdlc *n_hdlc_alloc (void) 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 --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index 9d60a762464f..80763b17f7e0 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c @@ -122,6 +122,7 @@ void n_tty_flush_buffer(struct tty_struct * tty) 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 @@ static inline void n_tty_receive_break(struct tty_struct *tty) } 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 @@ static inline void n_tty_receive_parity_error(struct tty_struct *tty, 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 @@ send_signal: 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 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp, 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 @@ do_it_again: 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 @@ do_it_again: 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 @@ static unsigned int normal_poll(struct tty_struct * tty, struct file * file, pol { 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 --git a/drivers/char/pcxx.c b/drivers/char/pcxx.c index 9b0418faf00f..27e1b0eff49b 100644 --- a/drivers/char/pcxx.c +++ b/drivers/char/pcxx.c @@ -869,6 +869,7 @@ static void pcxe_flush_buffer(struct tty_struct *tty) 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 @@ static void doevent(int crd) 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 @@ static void doevent(int crd) tty->ldisc.write_wakeup) (tty->ldisc.write_wakeup)(tty); wake_up_interruptible(&tty->write_wait); + wake_up_interruptible(&tty->poll_wait); } } } diff --git a/drivers/char/pty.c b/drivers/char/pty.c index 5ee1ee5b1e8f..80b073986e95 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c @@ -75,6 +75,7 @@ static void pty_close(struct tty_struct * tty, struct file * filp) 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 @@ static void pty_close(struct tty_struct * tty, struct file * filp) 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 @@ static void pty_flush_buffer(struct tty_struct *tty) if (to->packet) { tty->ctrl_status |= TIOCPKT_FLUSHWRITE; wake_up_interruptible(&to->read_wait); + wake_up_interruptible(&to->poll_wait); } } diff --git a/drivers/char/random.c b/drivers/char/random.c index 944a690aaa32..0a8922720862 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -425,6 +425,7 @@ static struct timer_rand_state extract_timer_state; 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 @@ __initfunc(void rand_initialize(void)) #endif extract_timer_state.dont_count_entropy = 1; random_read_wait = NULL; + random_poll_wait = NULL; random_write_wait = NULL; } @@ -763,7 +765,10 @@ static void add_timer_randomness(struct random_bucket *r, /* 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 @@ static ssize_t extract_entropy(struct random_bucket *r, char * buf, 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 @@ random_poll(struct file *file, poll_table * wait) { 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 @@ random_ioctl(struct inode * inode, struct file * file, * 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 @@ random_ioctl(struct inode * inode, struct file * file, * 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 --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c index 427bbf7233e9..c389c4fb7563 100644 --- a/drivers/char/rio/riointr.c +++ b/drivers/char/rio/riointr.c @@ -254,6 +254,7 @@ char * en; 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 --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 7764997b580f..a5a9ae671393 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c @@ -1331,6 +1331,7 @@ static void rc_flush_buffer(struct tty_struct *tty) 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 @@ static void do_softint(void *private_) tty->ldisc.write_wakeup) (tty->ldisc.write_wakeup)(tty); wake_up_interruptible(&tty->write_wait); + wake_up_interruptible(&tty->poll_wait); } } diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 13aa8edec27a..a53a56c139f0 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c @@ -443,6 +443,7 @@ static _INLINE_ void rp_do_transmit(struct r_port *info) 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 @@ static void rp_hangup(struct tty_struct *tty) 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 --git a/drivers/char/serial.c b/drivers/char/serial.c index 0b03cb87c2f7..cc18c7070d7c 100644 --- a/drivers/char/serial.c +++ b/drivers/char/serial.c @@ -816,6 +816,7 @@ static void do_softint(void *private_) 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 @@ static void rs_flush_buffer(struct tty_struct *tty) 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 --git a/drivers/char/serial167.c b/drivers/char/serial167.c index b3ff152579f6..a719786fcd91 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c @@ -775,6 +775,7 @@ do_softint(void *private_) (tty->ldisc.write_wakeup)(tty); } wake_up_interruptible(&tty->write_wait); + wake_up_interruptible(&tty->poll_wait); } } /* do_softint */ @@ -1332,6 +1333,7 @@ cy_flush_buffer(struct tty_struct *tty) 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 --git a/drivers/char/specialix.c b/drivers/char/specialix.c index 5aaa0cbc0ae3..8820b8f23799 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c @@ -1733,6 +1733,7 @@ static void sx_flush_buffer(struct tty_struct *tty) 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 @@ static void do_softint(void *private_) tty->ldisc.write_wakeup) (tty->ldisc.write_wakeup)(tty); wake_up_interruptible(&tty->write_wait); + wake_up_interruptible(&tty->poll_wait); } } diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index a98afcdd11ac..0f2f1cbe0ba0 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c @@ -1883,6 +1883,7 @@ static void stl_flushbuffer(struct tty_struct *tty) 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 @@ static void stl_offintr(void *private) 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 --git a/drivers/char/sx.c b/drivers/char/sx.c index 515bf0a41c66..077091310678 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c @@ -1064,6 +1064,7 @@ void sx_transmit_chars (struct sx_port *port) 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 --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 5feeeef8028d..524794f98958 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c @@ -1280,6 +1280,7 @@ void mgsl_bh_transmit_data( struct mgsl_struct *info, unsigned short Datacount ) (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 @@ static void mgsl_flush_buffer(struct tty_struct *tty) 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 --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 08a482bac4fa..0b415b366bf0 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -434,6 +434,7 @@ void do_tty_hangup(void *data) 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 @@ void stop_tty(struct tty_struct *tty) 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 @@ void start_tty(struct tty_struct *tty) 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 @@ void start_tty(struct tty_struct *tty) 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 @@ static void release_dev(struct file * filp) 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 @@ static void release_dev(struct file * filp) 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 @@ static int tty_fasync(int fd, struct file * filp, int on) 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 @@ static int tty_fasync(int fd, struct file * filp, int on) 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 --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index 2cad9dba6e25..8ea08fb13ab8 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c @@ -113,8 +113,11 @@ static void change_termios(struct tty_struct * tty, struct termios * new_termios } 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 @@ static void change_termios(struct tty_struct * tty, struct termios * new_termios else tty->ctrl_status |= TIOCPKT_NOSTOP; wake_up_interruptible(&tty->link->read_wait); + wake_up_interruptible(&tty->link->poll_wait); } } diff --git a/drivers/macintosh/macserial.c b/drivers/macintosh/macserial.c index 4553616d2520..ea8a6f74df0a 100644 --- a/drivers/macintosh/macserial.c +++ b/drivers/macintosh/macserial.c @@ -711,6 +711,7 @@ static void do_softint(void *private_) 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 @@ static void rs_flush_buffer(struct tty_struct *tty) 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 --git a/drivers/sbus/char/aurora.c b/drivers/sbus/char/aurora.c index fe064c034862..1998d43badeb 100644 --- a/drivers/sbus/char/aurora.c +++ b/drivers/sbus/char/aurora.c @@ -1702,6 +1702,7 @@ printk("aurora_flush_buffer: start\n"); 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 @@ printk("do_softint: start\n"); 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 --git a/drivers/sbus/char/sab82532.c b/drivers/sbus/char/sab82532.c index 08c81583b76e..606f7560d82b 100644 --- a/drivers/sbus/char/sab82532.c +++ b/drivers/sbus/char/sab82532.c @@ -671,6 +671,7 @@ static void do_softint(void *private_) 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 @@ static void sab82532_flush_buffer(struct tty_struct *tty) 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 --git a/drivers/sbus/char/su.c b/drivers/sbus/char/su.c index 02859bc0f35a..7d8b066960bf 100644 --- a/drivers/sbus/char/su.c +++ b/drivers/sbus/char/su.c @@ -694,6 +694,7 @@ static void do_softint(void *private_) 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 @@ su_flush_buffer(struct tty_struct *tty) 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 --git a/drivers/sbus/char/zs.c b/drivers/sbus/char/zs.c index fa6cbbf5c47c..0e76085debdd 100644 --- a/drivers/sbus/char/zs.c +++ b/drivers/sbus/char/zs.c @@ -737,6 +737,7 @@ static void do_softint(void *private_) 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 @@ static void zs_flush_buffer(struct tty_struct *tty) 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 --git a/drivers/sound/cmpci.c b/drivers/sound/cmpci.c index 00ba679578ba..4462b74e89e8 100644 --- a/drivers/sound/cmpci.c +++ b/drivers/sound/cmpci.c @@ -272,6 +272,7 @@ struct cm_state { 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 @@ struct cm_state { 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 @@ static void cm_update_ptr(struct cm_state *s) 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 @@ static void cm_update_ptr(struct cm_state *s) 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 @@ static void cm_handle_midi(struct cm_state *s) 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 @@ static void cm_handle_midi(struct cm_state *s) 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 @@ static unsigned int cm_poll(struct file *file, struct poll_table_struct *wait) 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 @@ static unsigned int cm_midi_poll(struct file *file, struct poll_table_struct *wa 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 @@ int __init init_cmpci(void) } 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 --git a/drivers/sound/es1370.c b/drivers/sound/es1370.c index ed9d9efd766f..6362876717c4 100644 --- a/drivers/sound/es1370.c +++ b/drivers/sound/es1370.c @@ -355,6 +355,7 @@ struct es1370_state { 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 @@ struct es1370_state { 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 @@ static void es1370_update_ptr(struct es1370_state *s) 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 @@ static void es1370_update_ptr(struct es1370_state *s) 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 @@ static void es1370_update_ptr(struct es1370_state *s) 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 @@ static void es1370_handle_midi(struct es1370_state *s) 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 @@ static void es1370_handle_midi(struct es1370_state *s) 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 @@ static unsigned int es1370_poll(struct file *file, struct poll_table_struct *wai 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 @@ static unsigned int es1370_midi_poll(struct file *file, struct poll_table_struct 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 @@ __initfunc(int init_es1370(void)) } 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 --git a/drivers/sound/es1371.c b/drivers/sound/es1371.c index e98751bbe7d3..1676b41294e1 100644 --- a/drivers/sound/es1371.c +++ b/drivers/sound/es1371.c @@ -471,6 +471,7 @@ struct es1371_state { 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 @@ struct es1371_state { 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 @@ static void es1371_update_ptr(struct es1371_state *s) 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 @@ static void es1371_update_ptr(struct es1371_state *s) 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 @@ static void es1371_update_ptr(struct es1371_state *s) 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 @@ static void es1371_handle_midi(struct es1371_state *s) 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 @@ static void es1371_handle_midi(struct es1371_state *s) 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 @@ static unsigned int es1371_poll(struct file *file, struct poll_table_struct *wai 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 @@ static unsigned int es1371_midi_poll(struct file *file, struct poll_table_struct 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 @@ __initfunc(static int probe_chip(struct pci_dev *pcidev, int index)) 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 --git a/drivers/sound/maestro.c b/drivers/sound/maestro.c index cf0246ebc9d6..48360865fd86 100644 --- a/drivers/sound/maestro.c +++ b/drivers/sound/maestro.c @@ -396,6 +396,7 @@ struct ess_state { /* 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 @@ ess_update_ptr(struct ess_state *s) 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 @@ ess_update_ptr(struct ess_state *s) 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 @@ ess_update_ptr(struct ess_state *s) } 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 @@ static unsigned int ess_poll(struct file *file, struct poll_table_struct *wait) 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 @@ maestro_install(struct pci_dev *pcidev, int card_type) 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 --git a/drivers/sound/sonicvibes.c b/drivers/sound/sonicvibes.c index 011c622c37b3..926f3c6af992 100644 --- a/drivers/sound/sonicvibes.c +++ b/drivers/sound/sonicvibes.c @@ -321,6 +321,7 @@ struct sv_state { 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 @@ static void sv_update_ptr(struct sv_state *s) 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 @@ static void sv_update_ptr(struct sv_state *s) 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 @@ static void sv_update_ptr(struct sv_state *s) 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 @@ static unsigned int sv_poll(struct file *file, struct poll_table_struct *wait) 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 @@ __initfunc(int init_sonicvibes(void)) 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 --git a/include/linux/tty.h b/include/linux/tty.h index e5abf885f1aa..161bac4c2682 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -277,6 +277,7 @@ struct tty_struct { 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 --git a/masq.patch b/masq.patch deleted file mode 100644 index 7881f1e85208..000000000000 --- a/masq.patch +++ /dev/null @@ -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 ####