提交 97ef38b8 编写于 作者: P Peter Hurley 提交者: Greg Kroah-Hartman

tty: Replace TTY_THROTTLED bit tests with tty_throttled()

Abstract TTY_THROTTLED bit tests with tty_throttled().
Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 18900ca6
...@@ -2316,7 +2316,7 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term ...@@ -2316,7 +2316,7 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term
/* Handle transition away from B0 status */ /* Handle transition away from B0 status */
if (!(old_termios->c_cflag & CBAUD) && C_BAUD(tty)) { if (!(old_termios->c_cflag & CBAUD) && C_BAUD(tty)) {
info->serial_signals |= SerialSignal_DTR; info->serial_signals |= SerialSignal_DTR;
if (!C_CRTSCTS(tty) || !test_bit(TTY_THROTTLED, &tty->flags)) if (!C_CRTSCTS(tty) || !tty_throttled(tty))
info->serial_signals |= SerialSignal_RTS; info->serial_signals |= SerialSignal_RTS;
spin_lock_irqsave(&info->lock, flags); spin_lock_irqsave(&info->lock, flags);
set_signals(info); set_signals(info);
......
...@@ -895,7 +895,7 @@ static void sdio_uart_set_termios(struct tty_struct *tty, ...@@ -895,7 +895,7 @@ static void sdio_uart_set_termios(struct tty_struct *tty,
/* Handle transition away from B0 status */ /* Handle transition away from B0 status */
if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) { if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) {
unsigned int mask = TIOCM_DTR; unsigned int mask = TIOCM_DTR;
if (!(cflag & CRTSCTS) || !test_bit(TTY_THROTTLED, &tty->flags)) if (!(cflag & CRTSCTS) || !tty_throttled(tty))
mask |= TIOCM_RTS; mask |= TIOCM_RTS;
sdio_uart_set_mctrl(port, mask); sdio_uart_set_mctrl(port, mask);
} }
......
...@@ -2029,7 +2029,7 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial) ...@@ -2029,7 +2029,7 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
tty = tty_port_tty_get(&serial->port); tty = tty_port_tty_get(&serial->port);
if (tty && test_bit(TTY_THROTTLED, &tty->flags)) { if (tty && tty_throttled(tty)) {
tty_kref_put(tty); tty_kref_put(tty);
return -1; return -1;
} }
......
...@@ -1305,7 +1305,7 @@ static void fwtty_set_termios(struct tty_struct *tty, struct ktermios *old) ...@@ -1305,7 +1305,7 @@ static void fwtty_set_termios(struct tty_struct *tty, struct ktermios *old)
if ((baud == 0) && (old->c_cflag & CBAUD)) { if ((baud == 0) && (old->c_cflag & CBAUD)) {
port->mctrl &= ~(TIOCM_DTR | TIOCM_RTS); port->mctrl &= ~(TIOCM_DTR | TIOCM_RTS);
} else if ((baud != 0) && !(old->c_cflag & CBAUD)) { } else if ((baud != 0) && !(old->c_cflag & CBAUD)) {
if (C_CRTSCTS(tty) || !test_bit(TTY_THROTTLED, &tty->flags)) if (C_CRTSCTS(tty) || !tty_throttled(tty))
port->mctrl |= TIOCM_DTR | TIOCM_RTS; port->mctrl |= TIOCM_DTR | TIOCM_RTS;
else else
port->mctrl |= TIOCM_DTR; port->mctrl |= TIOCM_DTR;
......
...@@ -150,7 +150,7 @@ static void __speakup_paste_selection(struct work_struct *work) ...@@ -150,7 +150,7 @@ static void __speakup_paste_selection(struct work_struct *work)
add_wait_queue(&vc->paste_wait, &wait); add_wait_queue(&vc->paste_wait, &wait);
while (sel_buffer && sel_buffer_lth > pasted) { while (sel_buffer && sel_buffer_lth > pasted) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
if (test_bit(TTY_THROTTLED, &tty->flags)) { if (tty_throttled(tty)) {
schedule(); schedule();
continue; continue;
} }
......
...@@ -1342,7 +1342,7 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios) ...@@ -1342,7 +1342,7 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
/* Handle transition away from B0 status */ /* Handle transition away from B0 status */
if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) { if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) {
info->MCR |= SER_DTR; info->MCR |= SER_DTR;
if (!C_CRTSCTS(tty) || !test_bit(TTY_THROTTLED, &tty->flags)) if (!C_CRTSCTS(tty) || !tty_throttled(tty))
info->MCR |= SER_RTS; info->MCR |= SER_RTS;
local_irq_save(flags); local_irq_save(flags);
rtsdtr_ctrl(info->MCR); rtsdtr_ctrl(info->MCR);
......
...@@ -632,7 +632,7 @@ int hvc_poll(struct hvc_struct *hp) ...@@ -632,7 +632,7 @@ int hvc_poll(struct hvc_struct *hp)
goto bail; goto bail;
/* Now check if we can get data (are we throttled ?) */ /* Now check if we can get data (are we throttled ?) */
if (test_bit(TTY_THROTTLED, &tty->flags)) if (tty_throttled(tty))
goto throttled; goto throttled;
/* If we aren't notifier driven and aren't throttled, we always /* If we aren't notifier driven and aren't throttled, we always
......
...@@ -600,7 +600,7 @@ static int hvcs_io(struct hvcs_struct *hvcsd) ...@@ -600,7 +600,7 @@ static int hvcs_io(struct hvcs_struct *hvcsd)
hvcs_try_write(hvcsd); hvcs_try_write(hvcsd);
if (!tty || test_bit(TTY_THROTTLED, &tty->flags)) { if (!tty || tty_throttled(tty)) {
hvcsd->todo_mask &= ~(HVCS_READ_MASK); hvcsd->todo_mask &= ~(HVCS_READ_MASK);
goto bail; goto bail;
} else if (!(hvcsd->todo_mask & (HVCS_READ_MASK))) } else if (!(hvcsd->todo_mask & (HVCS_READ_MASK)))
......
...@@ -509,7 +509,7 @@ static irqreturn_t hvsi_interrupt(int irq, void *arg) ...@@ -509,7 +509,7 @@ static irqreturn_t hvsi_interrupt(int irq, void *arg)
} }
spin_lock_irqsave(&hp->lock, flags); spin_lock_irqsave(&hp->lock, flags);
if (tty && hp->n_throttle && !test_bit(TTY_THROTTLED, &tty->flags)) { if (tty && hp->n_throttle && !tty_throttled(tty)) {
/* we weren't hung up and we weren't throttled, so we can /* we weren't hung up and we weren't throttled, so we can
* deliver the rest now */ * deliver the rest now */
hvsi_send_overflow(hp); hvsi_send_overflow(hp);
......
...@@ -1394,7 +1394,7 @@ static int moxa_poll_port(struct moxa_port *p, unsigned int handle, ...@@ -1394,7 +1394,7 @@ static int moxa_poll_port(struct moxa_port *p, unsigned int handle,
tty_wakeup(tty); tty_wakeup(tty);
} }
if (inited && !test_bit(TTY_THROTTLED, &tty->flags) && if (inited && !tty_throttled(tty) &&
MoxaPortRxQueue(p) > 0) { /* RX */ MoxaPortRxQueue(p) > 0) { /* RX */
MoxaPortReadData(p); MoxaPortReadData(p);
tty_schedule_flip(&p->port); tty_schedule_flip(&p->port);
......
...@@ -826,7 +826,7 @@ static int receive_data(enum port_type index, struct nozomi *dc) ...@@ -826,7 +826,7 @@ static int receive_data(enum port_type index, struct nozomi *dc)
size = __le32_to_cpu(readl(addr)); size = __le32_to_cpu(readl(addr));
/* DBG1( "%d bytes port: %d", size, index); */ /* DBG1( "%d bytes port: %d", size, index); */
if (tty && test_bit(TTY_THROTTLED, &tty->flags)) { if (tty && tty_throttled(tty)) {
DBG1("No room in tty, don't read data, don't ack interrupt, " DBG1("No room in tty, don't read data, don't ack interrupt, "
"disable interrupt"); "disable interrupt");
......
...@@ -1350,7 +1350,7 @@ static void uart_set_termios(struct tty_struct *tty, ...@@ -1350,7 +1350,7 @@ static void uart_set_termios(struct tty_struct *tty,
/* Handle transition away from B0 status */ /* Handle transition away from B0 status */
else if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) { else if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) {
unsigned int mask = TIOCM_DTR; unsigned int mask = TIOCM_DTR;
if (!(cflag & CRTSCTS) || !test_bit(TTY_THROTTLED, &tty->flags)) if (!(cflag & CRTSCTS) || !tty_throttled(tty))
mask |= TIOCM_RTS; mask |= TIOCM_RTS;
uart_set_mctrl(uport, mask); uart_set_mctrl(uport, mask);
} }
......
...@@ -3049,7 +3049,7 @@ static void mgsl_set_termios(struct tty_struct *tty, struct ktermios *old_termio ...@@ -3049,7 +3049,7 @@ static void mgsl_set_termios(struct tty_struct *tty, struct ktermios *old_termio
/* Handle transition away from B0 status */ /* Handle transition away from B0 status */
if (!(old_termios->c_cflag & CBAUD) && C_BAUD(tty)) { if (!(old_termios->c_cflag & CBAUD) && C_BAUD(tty)) {
info->serial_signals |= SerialSignal_DTR; info->serial_signals |= SerialSignal_DTR;
if (!C_CRTSCTS(tty) || !test_bit(TTY_THROTTLED, &tty->flags)) if (!C_CRTSCTS(tty) || !tty_throttled(tty))
info->serial_signals |= SerialSignal_RTS; info->serial_signals |= SerialSignal_RTS;
spin_lock_irqsave(&info->irq_spinlock,flags); spin_lock_irqsave(&info->irq_spinlock,flags);
usc_set_serial_signals(info); usc_set_serial_signals(info);
......
...@@ -784,7 +784,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) ...@@ -784,7 +784,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
/* Handle transition away from B0 status */ /* Handle transition away from B0 status */
if (!(old_termios->c_cflag & CBAUD) && C_BAUD(tty)) { if (!(old_termios->c_cflag & CBAUD) && C_BAUD(tty)) {
info->signals |= SerialSignal_DTR; info->signals |= SerialSignal_DTR;
if (!C_CRTSCTS(tty) || !test_bit(TTY_THROTTLED, &tty->flags)) if (!C_CRTSCTS(tty) || !tty_throttled(tty))
info->signals |= SerialSignal_RTS; info->signals |= SerialSignal_RTS;
spin_lock_irqsave(&info->lock,flags); spin_lock_irqsave(&info->lock,flags);
set_signals(info); set_signals(info);
......
...@@ -881,7 +881,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) ...@@ -881,7 +881,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
/* Handle transition away from B0 status */ /* Handle transition away from B0 status */
if (!(old_termios->c_cflag & CBAUD) && C_BAUD(tty)) { if (!(old_termios->c_cflag & CBAUD) && C_BAUD(tty)) {
info->serial_signals |= SerialSignal_DTR; info->serial_signals |= SerialSignal_DTR;
if (!C_CRTSCTS(tty) || !test_bit(TTY_THROTTLED, &tty->flags)) if (!C_CRTSCTS(tty) || !tty_throttled(tty))
info->serial_signals |= SerialSignal_RTS; info->serial_signals |= SerialSignal_RTS;
spin_lock_irqsave(&info->lock,flags); spin_lock_irqsave(&info->lock,flags);
set_signals(info); set_signals(info);
......
...@@ -158,7 +158,7 @@ int tty_throttle_safe(struct tty_struct *tty) ...@@ -158,7 +158,7 @@ int tty_throttle_safe(struct tty_struct *tty)
int ret = 0; int ret = 0;
mutex_lock(&tty->throttle_mutex); mutex_lock(&tty->throttle_mutex);
if (!test_bit(TTY_THROTTLED, &tty->flags)) { if (!tty_throttled(tty)) {
if (tty->flow_change != TTY_THROTTLE_SAFE) if (tty->flow_change != TTY_THROTTLE_SAFE)
ret = 1; ret = 1;
else { else {
...@@ -189,7 +189,7 @@ int tty_unthrottle_safe(struct tty_struct *tty) ...@@ -189,7 +189,7 @@ int tty_unthrottle_safe(struct tty_struct *tty)
int ret = 0; int ret = 0;
mutex_lock(&tty->throttle_mutex); mutex_lock(&tty->throttle_mutex);
if (test_bit(TTY_THROTTLED, &tty->flags)) { if (tty_throttled(tty)) {
if (tty->flow_change != TTY_UNTHROTTLE_SAFE) if (tty->flow_change != TTY_UNTHROTTLE_SAFE)
ret = 1; ret = 1;
else { else {
......
...@@ -354,7 +354,7 @@ int paste_selection(struct tty_struct *tty) ...@@ -354,7 +354,7 @@ int paste_selection(struct tty_struct *tty)
add_wait_queue(&vc->paste_wait, &wait); add_wait_queue(&vc->paste_wait, &wait);
while (sel_buffer && sel_buffer_lth > pasted) { while (sel_buffer && sel_buffer_lth > pasted) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
if (test_bit(TTY_THROTTLED, &tty->flags)) { if (tty_throttled(tty)) {
schedule(); schedule();
continue; continue;
} }
......
...@@ -512,7 +512,7 @@ static void gs_rx_push(unsigned long _port) ...@@ -512,7 +512,7 @@ static void gs_rx_push(unsigned long _port)
req = list_first_entry(queue, struct usb_request, list); req = list_first_entry(queue, struct usb_request, list);
/* leave data queued if tty was rx throttled */ /* leave data queued if tty was rx throttled */
if (tty && test_bit(TTY_THROTTLED, &tty->flags)) if (tty && tty_throttled(tty))
break; break;
switch (req->status) { switch (req->status) {
...@@ -579,7 +579,7 @@ static void gs_rx_push(unsigned long _port) ...@@ -579,7 +579,7 @@ static void gs_rx_push(unsigned long _port)
* from starving ... but it's not clear that case ever happens. * from starving ... but it's not clear that case ever happens.
*/ */
if (!list_empty(queue) && tty) { if (!list_empty(queue) && tty) {
if (!test_bit(TTY_THROTTLED, &tty->flags)) { if (!tty_throttled(tty)) {
if (do_push) if (do_push)
tasklet_schedule(&port->push); tasklet_schedule(&port->push);
else else
......
...@@ -699,8 +699,7 @@ static void digi_set_termios(struct tty_struct *tty, ...@@ -699,8 +699,7 @@ static void digi_set_termios(struct tty_struct *tty,
/* don't set RTS if using hardware flow control */ /* don't set RTS if using hardware flow control */
/* and throttling input */ /* and throttling input */
modem_signals = TIOCM_DTR; modem_signals = TIOCM_DTR;
if (!C_CRTSCTS(tty) || if (!C_CRTSCTS(tty) || !tty_throttled(tty))
!test_bit(TTY_THROTTLED, &tty->flags))
modem_signals |= TIOCM_RTS; modem_signals |= TIOCM_RTS;
digi_set_modem_signals(port, modem_signals, 1); digi_set_modem_signals(port, modem_signals, 1);
} }
......
...@@ -365,6 +365,11 @@ static inline bool tty_io_error(struct tty_struct *tty) ...@@ -365,6 +365,11 @@ static inline bool tty_io_error(struct tty_struct *tty)
return test_bit(TTY_IO_ERROR, &tty->flags); return test_bit(TTY_IO_ERROR, &tty->flags);
} }
static inline bool tty_throttled(struct tty_struct *tty)
{
return test_bit(TTY_THROTTLED, &tty->flags);
}
#ifdef CONFIG_TTY #ifdef CONFIG_TTY
extern void console_init(void); extern void console_init(void);
extern void tty_kref_put(struct tty_struct *tty); extern void tty_kref_put(struct tty_struct *tty);
......
...@@ -166,7 +166,7 @@ void ircomm_tty_set_termios(struct tty_struct *tty, ...@@ -166,7 +166,7 @@ void ircomm_tty_set_termios(struct tty_struct *tty,
/* Handle transition away from B0 status */ /* Handle transition away from B0 status */
if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) { if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) {
self->settings.dte |= IRCOMM_DTR; self->settings.dte |= IRCOMM_DTR;
if (!C_CRTSCTS(tty) || !test_bit(TTY_THROTTLED, &tty->flags)) if (!C_CRTSCTS(tty) || !tty_throttled(tty))
self->settings.dte |= IRCOMM_RTS; self->settings.dte |= IRCOMM_RTS;
ircomm_param_request(self, IRCOMM_DTE, TRUE); ircomm_param_request(self, IRCOMM_DTE, TRUE);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册