Commit b963a844 authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

[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: default avatarJiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Acked-by: default avatarTilman Schmidt <tilman@imap.cc>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1ed0c0b7
...@@ -527,10 +527,8 @@ static void do_softint(unsigned long private_) ...@@ -527,10 +527,8 @@ static void do_softint(unsigned long private_)
if (!tty) if (!tty)
return; return;
if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) { if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event))
tty_wakeup(tty); tty_wakeup(tty);
wake_up_interruptible(&tty->write_wait);
}
} }
/* /*
...@@ -968,7 +966,6 @@ static void rs_flush_buffer(struct tty_struct *tty) ...@@ -968,7 +966,6 @@ static void rs_flush_buffer(struct tty_struct *tty)
local_irq_save(flags); local_irq_save(flags);
info->xmit.head = info->xmit.tail = 0; info->xmit.head = info->xmit.tail = 0;
local_irq_restore(flags); local_irq_restore(flags);
wake_up_interruptible(&tty->write_wait);
tty_wakeup(tty); tty_wakeup(tty);
} }
......
...@@ -4488,7 +4488,6 @@ static void cy_flush_buffer(struct tty_struct *tty) ...@@ -4488,7 +4488,6 @@ static void cy_flush_buffer(struct tty_struct *tty)
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} }
tty_wakeup(tty); tty_wakeup(tty);
wake_up_interruptible(&tty->write_wait);
} /* cy_flush_buffer */ } /* cy_flush_buffer */
/* /*
......
...@@ -844,7 +844,6 @@ static void pc_flush_buffer(struct tty_struct *tty) ...@@ -844,7 +844,6 @@ static void pc_flush_buffer(struct tty_struct *tty)
fepcmd(ch, STOUT, (unsigned) tail, 0, 0, 0); fepcmd(ch, STOUT, (unsigned) tail, 0, 0, 0);
memoff(ch); memoff(ch);
spin_unlock_irqrestore(&epca_lock, flags); spin_unlock_irqrestore(&epca_lock, flags);
wake_up_interruptible(&tty->write_wait);
tty_wakeup(tty); tty_wakeup(tty);
} /* End pc_flush_buffer */ } /* End pc_flush_buffer */
...@@ -1795,7 +1794,6 @@ static void doevent(int crd) ...@@ -1795,7 +1794,6 @@ static void doevent(int crd)
{ /* Begin if LOWWAIT */ { /* Begin if LOWWAIT */
ch->statusflags &= ~LOWWAIT; ch->statusflags &= ~LOWWAIT;
tty_wakeup(tty); tty_wakeup(tty);
wake_up_interruptible(&tty->write_wait);
} /* End if LOWWAIT */ } /* End if LOWWAIT */
} else if (event & EMPTYTX_IND) { /* Begin EMPTYTX_IND */ } else if (event & EMPTYTX_IND) { /* Begin EMPTYTX_IND */
/* This event is generated by setup_empty_event */ /* This event is generated by setup_empty_event */
...@@ -1803,7 +1801,6 @@ static void doevent(int crd) ...@@ -1803,7 +1801,6 @@ static void doevent(int crd)
if (ch->statusflags & EMPTYWAIT) { /* Begin if EMPTYWAIT */ if (ch->statusflags & EMPTYWAIT) { /* Begin if EMPTYWAIT */
ch->statusflags &= ~EMPTYWAIT; ch->statusflags &= ~EMPTYWAIT;
tty_wakeup(tty); tty_wakeup(tty);
wake_up_interruptible(&tty->write_wait);
} /* End if EMPTYWAIT */ } /* End if EMPTYWAIT */
} /* End EMPTYTX_IND */ } /* End EMPTYTX_IND */
} /* End if valid tty */ } /* End if valid tty */
......
...@@ -382,7 +382,6 @@ void gs_flush_buffer(struct tty_struct *tty) ...@@ -382,7 +382,6 @@ void gs_flush_buffer(struct tty_struct *tty)
port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
spin_unlock_irqrestore (&port->driver_lock, flags); spin_unlock_irqrestore (&port->driver_lock, flags);
wake_up_interruptible(&tty->write_wait);
tty_wakeup(tty); tty_wakeup(tty);
func_exit (); func_exit ();
} }
......
...@@ -1373,15 +1373,7 @@ ip2_owake( PTTY tp) ...@@ -1373,15 +1373,7 @@ ip2_owake( PTTY tp)
ip2trace (CHANN, ITRC_SICMD, 10, 2, tp->flags, ip2trace (CHANN, ITRC_SICMD, 10, 2, tp->flags,
(1 << TTY_DO_WRITE_WAKEUP) ); (1 << TTY_DO_WRITE_WAKEUP) );
wake_up_interruptible ( &tp->write_wait ); tty_wakeup(tp);
if ( ( tp->flags & (1 << TTY_DO_WRITE_WAKEUP) )
&& tp->ldisc.write_wakeup )
{
(tp->ldisc.write_wakeup) ( tp );
ip2trace (CHANN, ITRC_SICMD, 11, 0 );
}
} }
static inline void static inline void
......
...@@ -1487,7 +1487,6 @@ static void isicom_flush_buffer(struct tty_struct *tty) ...@@ -1487,7 +1487,6 @@ static void isicom_flush_buffer(struct tty_struct *tty)
port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
spin_unlock_irqrestore(&card->card_lock, flags); spin_unlock_irqrestore(&card->card_lock, flags);
wake_up_interruptible(&tty->write_wait);
tty_wakeup(tty); tty_wakeup(tty);
} }
......
...@@ -2424,7 +2424,6 @@ static int stli_hostcmd(struct stlibrd *brdp, struct stliport *portp) ...@@ -2424,7 +2424,6 @@ static int stli_hostcmd(struct stlibrd *brdp, struct stliport *portp)
if (tty != NULL) { if (tty != NULL) {
tty_wakeup(tty); tty_wakeup(tty);
EBRDENABLE(brdp); EBRDENABLE(brdp);
wake_up_interruptible(&tty->write_wait);
} }
} }
......
...@@ -1254,9 +1254,7 @@ static void mxser_flush_buffer(struct tty_struct *tty) ...@@ -1254,9 +1254,7 @@ static void mxser_flush_buffer(struct tty_struct *tty)
spin_unlock_irqrestore(&info->slock, flags); spin_unlock_irqrestore(&info->slock, flags);
/* above added by shinhay */ /* above added by shinhay */
wake_up_interruptible(&tty->write_wait); tty_wakeup(tty);
if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup)
(tty->ldisc.write_wakeup) (tty);
} }
static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg)
......
...@@ -887,10 +887,8 @@ static void bh_transmit(MGSLPC_INFO *info) ...@@ -887,10 +887,8 @@ static void bh_transmit(MGSLPC_INFO *info)
if (debug_level >= DEBUG_LEVEL_BH) if (debug_level >= DEBUG_LEVEL_BH)
printk("bh_transmit() entry on %s\n", info->device_name); printk("bh_transmit() entry on %s\n", info->device_name);
if (tty) { if (tty)
tty_wakeup(tty); tty_wakeup(tty);
wake_up_interruptible(&tty->write_wait);
}
} }
static void bh_status(MGSLPC_INFO *info) static void bh_status(MGSLPC_INFO *info)
......
...@@ -162,13 +162,8 @@ void RIOTxEnable(char *en) ...@@ -162,13 +162,8 @@ void RIOTxEnable(char *en)
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN)) { if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN))
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); tty_wakeup(PortP->gs.tty);
if ((PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && PortP->gs.tty->ldisc.write_wakeup)
(PortP->gs.tty->ldisc.write_wakeup) (PortP->gs.tty);
rio_dprintk(RIO_DEBUG_INTR, "(%d/%d)\n", PortP->gs.wakeup_chars, PortP->gs.xmit_cnt);
wake_up_interruptible(&PortP->gs.tty->write_wait);
}
} }
......
...@@ -1229,7 +1229,6 @@ static void rc_flush_buffer(struct tty_struct *tty) ...@@ -1229,7 +1229,6 @@ static void rc_flush_buffer(struct tty_struct *tty)
port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
restore_flags(flags); restore_flags(flags);
wake_up_interruptible(&tty->write_wait);
tty_wakeup(tty); tty_wakeup(tty);
} }
...@@ -1570,10 +1569,8 @@ static void do_softint(struct work_struct *ugly_api) ...@@ -1570,10 +1569,8 @@ static void do_softint(struct work_struct *ugly_api)
if(!(tty = port->tty)) if(!(tty = port->tty))
return; return;
if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event)) { if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event))
tty_wakeup(tty); tty_wakeup(tty);
wake_up_interruptible(&tty->write_wait);
}
} }
static const struct tty_operations riscom_ops = { static const struct tty_operations riscom_ops = {
......
...@@ -474,7 +474,6 @@ static void rp_do_transmit(struct r_port *info) ...@@ -474,7 +474,6 @@ static void rp_do_transmit(struct r_port *info)
if (info->xmit_cnt < WAKEUP_CHARS) { if (info->xmit_cnt < WAKEUP_CHARS) {
tty_wakeup(tty); tty_wakeup(tty);
wake_up_interruptible(&tty->write_wait);
#ifdef ROCKETPORT_HAVE_POLL_WAIT #ifdef ROCKETPORT_HAVE_POLL_WAIT
wake_up_interruptible(&tty->poll_wait); wake_up_interruptible(&tty->poll_wait);
#endif #endif
...@@ -1772,7 +1771,6 @@ static int rp_write(struct tty_struct *tty, ...@@ -1772,7 +1771,6 @@ static int rp_write(struct tty_struct *tty,
end: end:
if (info->xmit_cnt < WAKEUP_CHARS) { if (info->xmit_cnt < WAKEUP_CHARS) {
tty_wakeup(tty); tty_wakeup(tty);
wake_up_interruptible(&tty->write_wait);
#ifdef ROCKETPORT_HAVE_POLL_WAIT #ifdef ROCKETPORT_HAVE_POLL_WAIT
wake_up_interruptible(&tty->poll_wait); wake_up_interruptible(&tty->poll_wait);
#endif #endif
...@@ -1841,7 +1839,6 @@ static void rp_flush_buffer(struct tty_struct *tty) ...@@ -1841,7 +1839,6 @@ static void rp_flush_buffer(struct tty_struct *tty)
info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
spin_unlock_irqrestore(&info->slock, flags); spin_unlock_irqrestore(&info->slock, flags);
wake_up_interruptible(&tty->write_wait);
#ifdef ROCKETPORT_HAVE_POLL_WAIT #ifdef ROCKETPORT_HAVE_POLL_WAIT
wake_up_interruptible(&tty->poll_wait); wake_up_interruptible(&tty->poll_wait);
#endif #endif
......
...@@ -2350,10 +2350,8 @@ static void do_softint(struct work_struct *work) ...@@ -2350,10 +2350,8 @@ static void do_softint(struct work_struct *work)
return; return;
} }
if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event)) { if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event))
tty_wakeup(tty); tty_wakeup(tty);
//wake_up_interruptible(&tty->write_wait);
}
func_exit(); func_exit();
} }
......
...@@ -1148,10 +1148,8 @@ static void mgsl_bh_transmit(struct mgsl_struct *info) ...@@ -1148,10 +1148,8 @@ static void mgsl_bh_transmit(struct mgsl_struct *info)
printk( "%s(%d):mgsl_bh_transmit() entry on %s\n", printk( "%s(%d):mgsl_bh_transmit() entry on %s\n",
__FILE__,__LINE__,info->device_name); __FILE__,__LINE__,info->device_name);
if (tty) { if (tty)
tty_wakeup(tty); tty_wakeup(tty);
wake_up_interruptible(&tty->write_wait);
}
/* if transmitter idle and loopmode_send_done_requested /* if transmitter idle and loopmode_send_done_requested
* then start echoing RxD to TxD * then start echoing RxD to TxD
...@@ -2340,7 +2338,6 @@ static void mgsl_flush_buffer(struct tty_struct *tty) ...@@ -2340,7 +2338,6 @@ static void mgsl_flush_buffer(struct tty_struct *tty)
del_timer(&info->tx_timer); del_timer(&info->tx_timer);
spin_unlock_irqrestore(&info->irq_spinlock,flags); spin_unlock_irqrestore(&info->irq_spinlock,flags);
wake_up_interruptible(&tty->write_wait);
tty_wakeup(tty); tty_wakeup(tty);
} }
......
...@@ -1045,7 +1045,6 @@ static void flush_buffer(struct tty_struct *tty) ...@@ -1045,7 +1045,6 @@ static void flush_buffer(struct tty_struct *tty)
info->tx_count = 0; info->tx_count = 0;
spin_unlock_irqrestore(&info->lock,flags); spin_unlock_irqrestore(&info->lock,flags);
wake_up_interruptible(&tty->write_wait);
tty_wakeup(tty); tty_wakeup(tty);
} }
...@@ -1933,10 +1932,8 @@ static void bh_transmit(struct slgt_info *info) ...@@ -1933,10 +1932,8 @@ static void bh_transmit(struct slgt_info *info)
struct tty_struct *tty = info->tty; struct tty_struct *tty = info->tty;
DBGBH(("%s bh_transmit\n", info->device_name)); DBGBH(("%s bh_transmit\n", info->device_name));
if (tty) { if (tty)
tty_wakeup(tty); tty_wakeup(tty);
wake_up_interruptible(&tty->write_wait);
}
} }
static void dsr_change(struct slgt_info *info) static void dsr_change(struct slgt_info *info)
......
...@@ -1258,7 +1258,6 @@ static void flush_buffer(struct tty_struct *tty) ...@@ -1258,7 +1258,6 @@ static void flush_buffer(struct tty_struct *tty)
del_timer(&info->tx_timer); del_timer(&info->tx_timer);
spin_unlock_irqrestore(&info->lock,flags); spin_unlock_irqrestore(&info->lock,flags);
wake_up_interruptible(&tty->write_wait);
tty_wakeup(tty); tty_wakeup(tty);
} }
...@@ -2127,10 +2126,8 @@ void bh_transmit(SLMP_INFO *info) ...@@ -2127,10 +2126,8 @@ void bh_transmit(SLMP_INFO *info)
printk( "%s(%d):%s bh_transmit() entry\n", printk( "%s(%d):%s bh_transmit() entry\n",
__FILE__,__LINE__,info->device_name); __FILE__,__LINE__,info->device_name);
if (tty) { if (tty)
tty_wakeup(tty); tty_wakeup(tty);
wake_up_interruptible(&tty->write_wait);
}
} }
void bh_status(SLMP_INFO *info) void bh_status(SLMP_INFO *info)
......
...@@ -599,19 +599,9 @@ out: ...@@ -599,19 +599,9 @@ out:
static void if_wake(unsigned long data) static void if_wake(unsigned long data)
{ {
struct cardstate *cs = (struct cardstate *) data; struct cardstate *cs = (struct cardstate *) data;
struct tty_struct *tty;
tty = cs->tty;
if (!tty)
return;
if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
tty->ldisc.write_wakeup) {
gig_dbg(DEBUG_IF, "write wakeup call");
tty->ldisc.write_wakeup(tty);
}
wake_up_interruptible(&tty->write_wait); if (cs->tty)
tty_wakeup(cs->tty);
} }
/*** interface to common ***/ /*** interface to common ***/
......
...@@ -1261,7 +1261,6 @@ isdn_tty_flush_buffer(struct tty_struct *tty) ...@@ -1261,7 +1261,6 @@ isdn_tty_flush_buffer(struct tty_struct *tty)
} }
isdn_tty_cleanup_xmit(info); isdn_tty_cleanup_xmit(info);
info->xmit_count = 0; info->xmit_count = 0;
wake_up_interruptible(&tty->write_wait);
tty_wakeup(tty); tty_wakeup(tty);
} }
......
...@@ -3173,12 +3173,8 @@ do_softint(void *private_) ...@@ -3173,12 +3173,8 @@ do_softint(void *private_)
if (!tty) if (!tty)
return; return;
if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) { if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event))
if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty_wakeup(tty);
tty->ldisc.write_wakeup)
(tty->ldisc.write_wakeup)(tty);
wake_up_interruptible(&tty->write_wait);
}
} }
static int static int
...@@ -3798,11 +3794,7 @@ rs_flush_buffer(struct tty_struct *tty) ...@@ -3798,11 +3794,7 @@ rs_flush_buffer(struct tty_struct *tty)
info->xmit.head = info->xmit.tail = 0; info->xmit.head = info->xmit.tail = 0;
restore_flags(flags); restore_flags(flags);
wake_up_interruptible(&tty->write_wait); tty_wakeup(tty);
if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
tty->ldisc.write_wakeup)
(tty->ldisc.write_wakeup)(tty);
} }
/* /*
......
...@@ -626,10 +626,8 @@ static void do_softint(unsigned long private_) ...@@ -626,10 +626,8 @@ static void do_softint(unsigned long private_)
if (!tty) if (!tty)
return; return;
if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) { if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event))
tty_wakeup(tty); tty_wakeup(tty);
wake_up_interruptible(&tty->write_wait);
}
} }
static int zs_startup(struct dec_serial * info) static int zs_startup(struct dec_serial * info)
......
...@@ -616,15 +616,7 @@ static void digi_wakeup_write_lock(struct work_struct *work) ...@@ -616,15 +616,7 @@ static void digi_wakeup_write_lock(struct work_struct *work)
static void digi_wakeup_write( struct usb_serial_port *port ) static void digi_wakeup_write( struct usb_serial_port *port )
{ {
tty_wakeup(port->tty);
struct tty_struct *tty = port->tty;
/* wake up port processes */
wake_up_interruptible( &port->write_wait );
/* wake up line discipline */
tty_wakeup(tty);
} }
......
...@@ -182,13 +182,8 @@ static void keyspan_pda_wakeup_write(struct work_struct *work) ...@@ -182,13 +182,8 @@ static void keyspan_pda_wakeup_write(struct work_struct *work)
struct keyspan_pda_private *priv = struct keyspan_pda_private *priv =
container_of(work, struct keyspan_pda_private, wakeup_work); container_of(work, struct keyspan_pda_private, wakeup_work);
struct usb_serial_port *port = priv->port; struct usb_serial_port *port = priv->port;
struct tty_struct *tty = port->tty;
/* wake up port processes */ tty_wakeup(port->tty);
wake_up_interruptible( &port->write_wait );
/* wake up line discipline */
tty_wakeup(tty);
} }
static void keyspan_pda_request_unthrottle(struct work_struct *work) static void keyspan_pda_request_unthrottle(struct work_struct *work)
......
...@@ -269,18 +269,8 @@ static void mos7720_bulk_out_data_callback(struct urb *urb) ...@@ -269,18 +269,8 @@ static void mos7720_bulk_out_data_callback(struct urb *urb)
tty = mos7720_port->port->tty; tty = mos7720_port->port->tty;
if (tty && mos7720_port->open) { if (tty && mos7720_port->open)
/* let the tty driver wakeup if it has a special * tty_wakeup(tty);
* write_wakeup function */
if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
tty->ldisc.write_wakeup)
(tty->ldisc.write_wakeup)(tty);
/* tell the tty driver that something has changed */
wake_up_interruptible(&tty->write_wait);
}
/* schedule_work(&mos7720_port->port->work); */
} }
/* /*
......
...@@ -755,18 +755,8 @@ static void mos7840_bulk_out_data_callback(struct urb *urb) ...@@ -755,18 +755,8 @@ static void mos7840_bulk_out_data_callback(struct urb *urb)
tty = mos7840_port->port->tty; tty = mos7840_port->port->tty;
if (tty && mos7840_port->open) { if (tty && mos7840_port->open)
/* let the tty driver wakeup if it has a special * tty_wakeup(tty);
* write_wakeup function */
if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP))
&& tty->ldisc.write_wakeup) {
(tty->ldisc.write_wakeup) (tty);
}
/* tell the tty driver that something has changed */
wake_up_interruptible(&tty->write_wait);
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment