Commit b963a8441cb95999c97bea379607071a869c65f0

Authored by Jiri Slaby
Committed by Linus Torvalds
1 parent 1ed0c0b730

[PATCH] Char: tty_wakeup cleanup

tty_wakeup cleanup

- remove wake_up_interruptible(&tty->write_wait) surrounding
  tty_wakup(tty);
- substitute tty->ldisc.write_wakeup(tty) + wake_up() by tty_wakeup(tty);

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Acked-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 24 changed files with 23 additions and 121 deletions Side-by-side Diff

drivers/char/amiserial.c
... ... @@ -527,10 +527,8 @@
527 527 if (!tty)
528 528 return;
529 529  
530   - if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) {
  530 + if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event))
531 531 tty_wakeup(tty);
532   - wake_up_interruptible(&tty->write_wait);
533   - }
534 532 }
535 533  
536 534 /*
... ... @@ -968,7 +966,6 @@
968 966 local_irq_save(flags);
969 967 info->xmit.head = info->xmit.tail = 0;
970 968 local_irq_restore(flags);
971   - wake_up_interruptible(&tty->write_wait);
972 969 tty_wakeup(tty);
973 970 }
974 971  
drivers/char/cyclades.c
... ... @@ -4488,7 +4488,6 @@
4488 4488 CY_UNLOCK(info, flags);
4489 4489 }
4490 4490 tty_wakeup(tty);
4491   - wake_up_interruptible(&tty->write_wait);
4492 4491 } /* cy_flush_buffer */
4493 4492  
4494 4493 /*
... ... @@ -844,7 +844,6 @@
844 844 fepcmd(ch, STOUT, (unsigned) tail, 0, 0, 0);
845 845 memoff(ch);
846 846 spin_unlock_irqrestore(&epca_lock, flags);
847   - wake_up_interruptible(&tty->write_wait);
848 847 tty_wakeup(tty);
849 848 } /* End pc_flush_buffer */
850 849  
... ... @@ -1795,7 +1794,6 @@
1795 1794 { /* Begin if LOWWAIT */
1796 1795 ch->statusflags &= ~LOWWAIT;
1797 1796 tty_wakeup(tty);
1798   - wake_up_interruptible(&tty->write_wait);
1799 1797 } /* End if LOWWAIT */
1800 1798 } else if (event & EMPTYTX_IND) { /* Begin EMPTYTX_IND */
1801 1799 /* This event is generated by setup_empty_event */
... ... @@ -1803,7 +1801,6 @@
1803 1801 if (ch->statusflags & EMPTYWAIT) { /* Begin if EMPTYWAIT */
1804 1802 ch->statusflags &= ~EMPTYWAIT;
1805 1803 tty_wakeup(tty);
1806   - wake_up_interruptible(&tty->write_wait);
1807 1804 } /* End if EMPTYWAIT */
1808 1805 } /* End EMPTYTX_IND */
1809 1806 } /* End if valid tty */
drivers/char/generic_serial.c
... ... @@ -382,7 +382,6 @@
382 382 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
383 383 spin_unlock_irqrestore (&port->driver_lock, flags);
384 384  
385   - wake_up_interruptible(&tty->write_wait);
386 385 tty_wakeup(tty);
387 386 func_exit ();
388 387 }
drivers/char/ip2/i2lib.c
... ... @@ -1373,15 +1373,7 @@
1373 1373 ip2trace (CHANN, ITRC_SICMD, 10, 2, tp->flags,
1374 1374 (1 << TTY_DO_WRITE_WAKEUP) );
1375 1375  
1376   - wake_up_interruptible ( &tp->write_wait );
1377   - if ( ( tp->flags & (1 << TTY_DO_WRITE_WAKEUP) )
1378   - && tp->ldisc.write_wakeup )
1379   - {
1380   - (tp->ldisc.write_wakeup) ( tp );
1381   -
1382   - ip2trace (CHANN, ITRC_SICMD, 11, 0 );
1383   -
1384   - }
  1376 + tty_wakeup(tp);
1385 1377 }
1386 1378  
1387 1379 static inline void
drivers/char/isicom.c
... ... @@ -1487,7 +1487,6 @@
1487 1487 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
1488 1488 spin_unlock_irqrestore(&card->card_lock, flags);
1489 1489  
1490   - wake_up_interruptible(&tty->write_wait);
1491 1490 tty_wakeup(tty);
1492 1491 }
1493 1492  
drivers/char/istallion.c
... ... @@ -2424,7 +2424,6 @@
2424 2424 if (tty != NULL) {
2425 2425 tty_wakeup(tty);
2426 2426 EBRDENABLE(brdp);
2427   - wake_up_interruptible(&tty->write_wait);
2428 2427 }
2429 2428 }
2430 2429  
drivers/char/mxser.c
... ... @@ -1254,9 +1254,7 @@
1254 1254 spin_unlock_irqrestore(&info->slock, flags);
1255 1255 /* above added by shinhay */
1256 1256  
1257   - wake_up_interruptible(&tty->write_wait);
1258   - if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup)
1259   - (tty->ldisc.write_wakeup) (tty);
  1257 + tty_wakeup(tty);
1260 1258 }
1261 1259  
1262 1260 static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg)
drivers/char/pcmcia/synclink_cs.c
... ... @@ -887,10 +887,8 @@
887 887 if (debug_level >= DEBUG_LEVEL_BH)
888 888 printk("bh_transmit() entry on %s\n", info->device_name);
889 889  
890   - if (tty) {
  890 + if (tty)
891 891 tty_wakeup(tty);
892   - wake_up_interruptible(&tty->write_wait);
893   - }
894 892 }
895 893  
896 894 static void bh_status(MGSLPC_INFO *info)
drivers/char/rio/riointr.c
... ... @@ -162,13 +162,8 @@
162 162  
163 163 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
164 164  
165   - if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN)) {
166   - rio_dprintk(RIO_DEBUG_INTR, "Waking up.... ldisc:%d (%d/%d)....", (int) (PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)), PortP->gs.wakeup_chars, PortP->gs.xmit_cnt);
167   - if ((PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && PortP->gs.tty->ldisc.write_wakeup)
168   - (PortP->gs.tty->ldisc.write_wakeup) (PortP->gs.tty);
169   - rio_dprintk(RIO_DEBUG_INTR, "(%d/%d)\n", PortP->gs.wakeup_chars, PortP->gs.xmit_cnt);
170   - wake_up_interruptible(&PortP->gs.tty->write_wait);
171   - }
  165 + if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN))
  166 + tty_wakeup(PortP->gs.tty);
172 167  
173 168 }
174 169  
drivers/char/riscom8.c
... ... @@ -1229,7 +1229,6 @@
1229 1229 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
1230 1230 restore_flags(flags);
1231 1231  
1232   - wake_up_interruptible(&tty->write_wait);
1233 1232 tty_wakeup(tty);
1234 1233 }
1235 1234  
1236 1235  
... ... @@ -1570,10 +1569,8 @@
1570 1569 if(!(tty = port->tty))
1571 1570 return;
1572 1571  
1573   - if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event)) {
  1572 + if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event))
1574 1573 tty_wakeup(tty);
1575   - wake_up_interruptible(&tty->write_wait);
1576   - }
1577 1574 }
1578 1575  
1579 1576 static const struct tty_operations riscom_ops = {
drivers/char/rocket.c
... ... @@ -474,7 +474,6 @@
474 474  
475 475 if (info->xmit_cnt < WAKEUP_CHARS) {
476 476 tty_wakeup(tty);
477   - wake_up_interruptible(&tty->write_wait);
478 477 #ifdef ROCKETPORT_HAVE_POLL_WAIT
479 478 wake_up_interruptible(&tty->poll_wait);
480 479 #endif
... ... @@ -1772,7 +1771,6 @@
1772 1771 end:
1773 1772 if (info->xmit_cnt < WAKEUP_CHARS) {
1774 1773 tty_wakeup(tty);
1775   - wake_up_interruptible(&tty->write_wait);
1776 1774 #ifdef ROCKETPORT_HAVE_POLL_WAIT
1777 1775 wake_up_interruptible(&tty->poll_wait);
1778 1776 #endif
... ... @@ -1841,7 +1839,6 @@
1841 1839 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
1842 1840 spin_unlock_irqrestore(&info->slock, flags);
1843 1841  
1844   - wake_up_interruptible(&tty->write_wait);
1845 1842 #ifdef ROCKETPORT_HAVE_POLL_WAIT
1846 1843 wake_up_interruptible(&tty->poll_wait);
1847 1844 #endif
drivers/char/specialix.c
... ... @@ -2350,10 +2350,8 @@
2350 2350 return;
2351 2351 }
2352 2352  
2353   - if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event)) {
  2353 + if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event))
2354 2354 tty_wakeup(tty);
2355   - //wake_up_interruptible(&tty->write_wait);
2356   - }
2357 2355  
2358 2356 func_exit();
2359 2357 }
drivers/char/synclink.c
... ... @@ -1148,10 +1148,8 @@
1148 1148 printk( "%s(%d):mgsl_bh_transmit() entry on %s\n",
1149 1149 __FILE__,__LINE__,info->device_name);
1150 1150  
1151   - if (tty) {
  1151 + if (tty)
1152 1152 tty_wakeup(tty);
1153   - wake_up_interruptible(&tty->write_wait);
1154   - }
1155 1153  
1156 1154 /* if transmitter idle and loopmode_send_done_requested
1157 1155 * then start echoing RxD to TxD
... ... @@ -2340,7 +2338,6 @@
2340 2338 del_timer(&info->tx_timer);
2341 2339 spin_unlock_irqrestore(&info->irq_spinlock,flags);
2342 2340  
2343   - wake_up_interruptible(&tty->write_wait);
2344 2341 tty_wakeup(tty);
2345 2342 }
2346 2343  
drivers/char/synclink_gt.c
... ... @@ -1045,7 +1045,6 @@
1045 1045 info->tx_count = 0;
1046 1046 spin_unlock_irqrestore(&info->lock,flags);
1047 1047  
1048   - wake_up_interruptible(&tty->write_wait);
1049 1048 tty_wakeup(tty);
1050 1049 }
1051 1050  
1052 1051  
... ... @@ -1933,10 +1932,8 @@
1933 1932 struct tty_struct *tty = info->tty;
1934 1933  
1935 1934 DBGBH(("%s bh_transmit\n", info->device_name));
1936   - if (tty) {
  1935 + if (tty)
1937 1936 tty_wakeup(tty);
1938   - wake_up_interruptible(&tty->write_wait);
1939   - }
1940 1937 }
1941 1938  
1942 1939 static void dsr_change(struct slgt_info *info)
drivers/char/synclinkmp.c
... ... @@ -1258,7 +1258,6 @@
1258 1258 del_timer(&info->tx_timer);
1259 1259 spin_unlock_irqrestore(&info->lock,flags);
1260 1260  
1261   - wake_up_interruptible(&tty->write_wait);
1262 1261 tty_wakeup(tty);
1263 1262 }
1264 1263  
1265 1264  
... ... @@ -2127,10 +2126,8 @@
2127 2126 printk( "%s(%d):%s bh_transmit() entry\n",
2128 2127 __FILE__,__LINE__,info->device_name);
2129 2128  
2130   - if (tty) {
  2129 + if (tty)
2131 2130 tty_wakeup(tty);
2132   - wake_up_interruptible(&tty->write_wait);
2133   - }
2134 2131 }
2135 2132  
2136 2133 void bh_status(SLMP_INFO *info)
drivers/isdn/gigaset/interface.c
... ... @@ -599,19 +599,9 @@
599 599 static void if_wake(unsigned long data)
600 600 {
601 601 struct cardstate *cs = (struct cardstate *) data;
602   - struct tty_struct *tty;
603 602  
604   - tty = cs->tty;
605   - if (!tty)
606   - return;
607   -
608   - if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
609   - tty->ldisc.write_wakeup) {
610   - gig_dbg(DEBUG_IF, "write wakeup call");
611   - tty->ldisc.write_wakeup(tty);
612   - }
613   -
614   - wake_up_interruptible(&tty->write_wait);
  603 + if (cs->tty)
  604 + tty_wakeup(cs->tty);
615 605 }
616 606  
617 607 /*** interface to common ***/
drivers/isdn/i4l/isdn_tty.c
... ... @@ -1261,7 +1261,6 @@
1261 1261 }
1262 1262 isdn_tty_cleanup_xmit(info);
1263 1263 info->xmit_count = 0;
1264   - wake_up_interruptible(&tty->write_wait);
1265 1264 tty_wakeup(tty);
1266 1265 }
1267 1266  
drivers/serial/crisv10.c
... ... @@ -3173,12 +3173,8 @@
3173 3173 if (!tty)
3174 3174 return;
3175 3175  
3176   - if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) {
3177   - if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
3178   - tty->ldisc.write_wakeup)
3179   - (tty->ldisc.write_wakeup)(tty);
3180   - wake_up_interruptible(&tty->write_wait);
3181   - }
  3176 + if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event))
  3177 + tty_wakeup(tty);
3182 3178 }
3183 3179  
3184 3180 static int
... ... @@ -3798,11 +3794,7 @@
3798 3794 info->xmit.head = info->xmit.tail = 0;
3799 3795 restore_flags(flags);
3800 3796  
3801   - wake_up_interruptible(&tty->write_wait);
3802   -
3803   - if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
3804   - tty->ldisc.write_wakeup)
3805   - (tty->ldisc.write_wakeup)(tty);
  3797 + tty_wakeup(tty);
3806 3798 }
3807 3799  
3808 3800 /*
... ... @@ -626,10 +626,8 @@
626 626 if (!tty)
627 627 return;
628 628  
629   - if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) {
  629 + if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event))
630 630 tty_wakeup(tty);
631   - wake_up_interruptible(&tty->write_wait);
632   - }
633 631 }
634 632  
635 633 static int zs_startup(struct dec_serial * info)
drivers/usb/serial/digi_acceleport.c
... ... @@ -616,15 +616,7 @@
616 616  
617 617 static void digi_wakeup_write( struct usb_serial_port *port )
618 618 {
619   -
620   - struct tty_struct *tty = port->tty;
621   -
622   -
623   - /* wake up port processes */
624   - wake_up_interruptible( &port->write_wait );
625   -
626   - /* wake up line discipline */
627   - tty_wakeup(tty);
  619 + tty_wakeup(port->tty);
628 620 }
629 621  
630 622  
drivers/usb/serial/keyspan_pda.c
... ... @@ -182,13 +182,8 @@
182 182 struct keyspan_pda_private *priv =
183 183 container_of(work, struct keyspan_pda_private, wakeup_work);
184 184 struct usb_serial_port *port = priv->port;
185   - struct tty_struct *tty = port->tty;
186 185  
187   - /* wake up port processes */
188   - wake_up_interruptible( &port->write_wait );
189   -
190   - /* wake up line discipline */
191   - tty_wakeup(tty);
  186 + tty_wakeup(port->tty);
192 187 }
193 188  
194 189 static void keyspan_pda_request_unthrottle(struct work_struct *work)
drivers/usb/serial/mos7720.c
... ... @@ -269,18 +269,8 @@
269 269  
270 270 tty = mos7720_port->port->tty;
271 271  
272   - if (tty && mos7720_port->open) {
273   - /* let the tty driver wakeup if it has a special *
274   - * write_wakeup function */
275   - if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
276   - tty->ldisc.write_wakeup)
277   - (tty->ldisc.write_wakeup)(tty);
278   -
279   - /* tell the tty driver that something has changed */
280   - wake_up_interruptible(&tty->write_wait);
281   - }
282   -
283   - /* schedule_work(&mos7720_port->port->work); */
  272 + if (tty && mos7720_port->open)
  273 + tty_wakeup(tty);
284 274 }
285 275  
286 276 /*
drivers/usb/serial/mos7840.c
... ... @@ -755,18 +755,8 @@
755 755  
756 756 tty = mos7840_port->port->tty;
757 757  
758   - if (tty && mos7840_port->open) {
759   - /* let the tty driver wakeup if it has a special *
760   - * write_wakeup function */
761   -
762   - if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP))
763   - && tty->ldisc.write_wakeup) {
764   - (tty->ldisc.write_wakeup) (tty);
765   - }
766   -
767   - /* tell the tty driver that something has changed */
768   - wake_up_interruptible(&tty->write_wait);
769   - }
  758 + if (tty && mos7840_port->open)
  759 + tty_wakeup(tty);
770 760  
771 761 }
772 762