Commit ee797069 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

TTY: cleanup tty->hw_stopped uses

tty->hw_stopped is set only by drivers to remember HW state. If it is
never set to 1 in a particular driver, there is no need to check it in
the driver at all. Remove such checks.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4d29994d
...@@ -142,8 +142,7 @@ static void transmit_chars(struct tty_struct *tty, struct serial_state *info, ...@@ -142,8 +142,7 @@ static void transmit_chars(struct tty_struct *tty, struct serial_state *info,
goto out; goto out;
} }
if (info->xmit.head == info->xmit.tail || tty->stopped || if (info->xmit.head == info->xmit.tail || tty->stopped) {
tty->hw_stopped) {
#ifdef SIMSERIAL_DEBUG #ifdef SIMSERIAL_DEBUG
printk("transmit_chars: head=%d, tail=%d, stopped=%d\n", printk("transmit_chars: head=%d, tail=%d, stopped=%d\n",
info->xmit.head, info->xmit.tail, tty->stopped); info->xmit.head, info->xmit.tail, tty->stopped);
...@@ -181,7 +180,7 @@ static void rs_flush_chars(struct tty_struct *tty) ...@@ -181,7 +180,7 @@ static void rs_flush_chars(struct tty_struct *tty)
struct serial_state *info = tty->driver_data; struct serial_state *info = tty->driver_data;
if (info->xmit.head == info->xmit.tail || tty->stopped || if (info->xmit.head == info->xmit.tail || tty->stopped ||
tty->hw_stopped || !info->xmit.buf) !info->xmit.buf)
return; return;
transmit_chars(tty, info, NULL); transmit_chars(tty, info, NULL);
...@@ -217,7 +216,7 @@ static int rs_write(struct tty_struct * tty, ...@@ -217,7 +216,7 @@ static int rs_write(struct tty_struct * tty,
* Hey, we transmit directly from here in our case * Hey, we transmit directly from here in our case
*/ */
if (CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE) && if (CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE) &&
!tty->stopped && !tty->hw_stopped) !tty->stopped)
transmit_chars(tty, info, NULL); transmit_chars(tty, info, NULL);
return ret; return ret;
...@@ -325,14 +324,6 @@ static int rs_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) ...@@ -325,14 +324,6 @@ static int rs_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
{
/* Handle turning off CRTSCTS */
if ((old_termios->c_cflag & CRTSCTS) &&
!(tty->termios.c_cflag & CRTSCTS)) {
tty->hw_stopped = 0;
}
}
/* /*
* This routine will shutdown a serial port; interrupts are disabled, and * This routine will shutdown a serial port; interrupts are disabled, and
* DTR is dropped if the hangup on close termio flag is on. * DTR is dropped if the hangup on close termio flag is on.
...@@ -481,7 +472,6 @@ static const struct tty_operations hp_ops = { ...@@ -481,7 +472,6 @@ static const struct tty_operations hp_ops = {
.throttle = rs_throttle, .throttle = rs_throttle,
.unthrottle = rs_unthrottle, .unthrottle = rs_unthrottle,
.send_xchar = rs_send_xchar, .send_xchar = rs_send_xchar,
.set_termios = rs_set_termios,
.hangup = rs_hangup, .hangup = rs_hangup,
.proc_fops = &rs_proc_fops, .proc_fops = &rs_proc_fops,
}; };
......
...@@ -1470,9 +1470,6 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios) ...@@ -1470,9 +1470,6 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
tty->termios.c_ospeed == old_termios->c_ospeed) tty->termios.c_ospeed == old_termios->c_ospeed)
return; return;
isdn_tty_change_speed(info); isdn_tty_change_speed(info);
if ((old_termios->c_cflag & CRTSCTS) &&
!(tty->termios.c_cflag & CRTSCTS))
tty->hw_stopped = 0;
} }
} }
......
...@@ -88,7 +88,6 @@ static inline void update_tty_status(struct ser_device *ser) ...@@ -88,7 +88,6 @@ static inline void update_tty_status(struct ser_device *ser)
{ {
ser->tty_status = ser->tty_status =
ser->tty->stopped << 5 | ser->tty->stopped << 5 |
ser->tty->hw_stopped << 4 |
ser->tty->flow_stopped << 3 | ser->tty->flow_stopped << 3 |
ser->tty->packet << 2 | ser->tty->packet << 2 |
ser->tty->port->low_latency << 1 | ser->tty->port->low_latency << 1 |
......
...@@ -449,7 +449,7 @@ static void rp_do_transmit(struct r_port *info) ...@@ -449,7 +449,7 @@ static void rp_do_transmit(struct r_port *info)
/* Loop sending data to FIFO until done or FIFO full */ /* Loop sending data to FIFO until done or FIFO full */
while (1) { while (1) {
if (tty->stopped || tty->hw_stopped) if (tty->stopped)
break; break;
c = min(info->xmit_fifo_room, info->xmit_cnt); c = min(info->xmit_fifo_room, info->xmit_cnt);
c = min(c, XMIT_BUF_SIZE - info->xmit_tail); c = min(c, XMIT_BUF_SIZE - info->xmit_tail);
...@@ -1106,15 +1106,12 @@ static void rp_set_termios(struct tty_struct *tty, ...@@ -1106,15 +1106,12 @@ static void rp_set_termios(struct tty_struct *tty,
/* Handle transition away from B0 status */ /* Handle transition away from B0 status */
if (!(old_termios->c_cflag & CBAUD) && (tty->termios.c_cflag & CBAUD)) { if (!(old_termios->c_cflag & CBAUD) && (tty->termios.c_cflag & CBAUD)) {
if (!tty->hw_stopped || !(tty->termios.c_cflag & CRTSCTS))
sSetRTS(cp); sSetRTS(cp);
sSetDTR(cp); sSetDTR(cp);
} }
if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios.c_cflag & CRTSCTS)) { if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios.c_cflag & CRTSCTS))
tty->hw_stopped = 0;
rp_start(tty); rp_start(tty);
}
} }
static int rp_break(struct tty_struct *tty, int break_state) static int rp_break(struct tty_struct *tty, int break_state)
...@@ -1570,10 +1567,10 @@ static int rp_put_char(struct tty_struct *tty, unsigned char ch) ...@@ -1570,10 +1567,10 @@ static int rp_put_char(struct tty_struct *tty, unsigned char ch)
spin_lock_irqsave(&info->slock, flags); spin_lock_irqsave(&info->slock, flags);
cp = &info->channel; cp = &info->channel;
if (!tty->stopped && !tty->hw_stopped && info->xmit_fifo_room == 0) if (!tty->stopped && info->xmit_fifo_room == 0)
info->xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp); info->xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp);
if (tty->stopped || tty->hw_stopped || info->xmit_fifo_room == 0 || info->xmit_cnt != 0) { if (tty->stopped || info->xmit_fifo_room == 0 || info->xmit_cnt != 0) {
info->xmit_buf[info->xmit_head++] = ch; info->xmit_buf[info->xmit_head++] = ch;
info->xmit_head &= XMIT_BUF_SIZE - 1; info->xmit_head &= XMIT_BUF_SIZE - 1;
info->xmit_cnt++; info->xmit_cnt++;
...@@ -1614,14 +1611,14 @@ static int rp_write(struct tty_struct *tty, ...@@ -1614,14 +1611,14 @@ static int rp_write(struct tty_struct *tty,
#endif #endif
cp = &info->channel; cp = &info->channel;
if (!tty->stopped && !tty->hw_stopped && info->xmit_fifo_room < count) if (!tty->stopped && info->xmit_fifo_room < count)
info->xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp); info->xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp);
/* /*
* If the write queue for the port is empty, and there is FIFO space, stuff bytes * If the write queue for the port is empty, and there is FIFO space, stuff bytes
* into FIFO. Use the write queue for temp storage. * into FIFO. Use the write queue for temp storage.
*/ */
if (!tty->stopped && !tty->hw_stopped && info->xmit_cnt == 0 && info->xmit_fifo_room > 0) { if (!tty->stopped && info->xmit_cnt == 0 && info->xmit_fifo_room > 0) {
c = min(count, info->xmit_fifo_room); c = min(count, info->xmit_fifo_room);
b = buf; b = buf;
...@@ -1669,7 +1666,7 @@ static int rp_write(struct tty_struct *tty, ...@@ -1669,7 +1666,7 @@ static int rp_write(struct tty_struct *tty,
retval += c; retval += c;
} }
if ((retval > 0) && !tty->stopped && !tty->hw_stopped) if ((retval > 0) && !tty->stopped)
set_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); set_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]);
end: end:
......
...@@ -630,8 +630,7 @@ static void rs_flush_chars(struct tty_struct *tty) ...@@ -630,8 +630,7 @@ static void rs_flush_chars(struct tty_struct *tty)
/* Enable transmitter */ /* Enable transmitter */
local_irq_save(flags); local_irq_save(flags);
if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || if (info->xmit_cnt <= 0 || tty->stopped || !info->xmit_buf) {
!info->xmit_buf) {
local_irq_restore(flags); local_irq_restore(flags);
return; return;
} }
...@@ -697,7 +696,7 @@ static int rs_write(struct tty_struct * tty, ...@@ -697,7 +696,7 @@ static int rs_write(struct tty_struct * tty,
total += c; total += c;
} }
if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped) { if (info->xmit_cnt && !tty->stopped) {
/* Enable transmitter */ /* Enable transmitter */
local_irq_disable(); local_irq_disable();
#ifndef USE_INTS #ifndef USE_INTS
...@@ -978,10 +977,8 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios) ...@@ -978,10 +977,8 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
change_speed(info, tty); change_speed(info, tty);
if ((old_termios->c_cflag & CRTSCTS) && if ((old_termios->c_cflag & CRTSCTS) &&
!(tty->termios.c_cflag & CRTSCTS)) { !(tty->termios.c_cflag & CRTSCTS))
tty->hw_stopped = 0;
rs_start(tty); rs_start(tty);
}
} }
......
...@@ -162,7 +162,7 @@ static unsigned int arc_serial_tx_empty(struct uart_port *port) ...@@ -162,7 +162,7 @@ static unsigned int arc_serial_tx_empty(struct uart_port *port)
/* /*
* Driver internal routine, used by both tty(serial core) as well as tx-isr * Driver internal routine, used by both tty(serial core) as well as tx-isr
* -Called under spinlock in either cases * -Called under spinlock in either cases
* -also tty->stopped / tty->hw_stopped has already been checked * -also tty->stopped has already been checked
* = by uart_start( ) before calling us * = by uart_start( ) before calling us
* = tx_ist checks that too before calling * = tx_ist checks that too before calling
*/ */
......
...@@ -2534,8 +2534,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) ...@@ -2534,8 +2534,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info)
} }
/* Normal char-by-char interrupt */ /* Normal char-by-char interrupt */
if (info->xmit.head == info->xmit.tail if (info->xmit.head == info->xmit.tail
|| info->port.tty->stopped || info->port.tty->stopped) {
|| info->port.tty->hw_stopped) {
DFLOW(DEBUG_LOG(info->line, "tx_int: stopped %i\n", DFLOW(DEBUG_LOG(info->line, "tx_int: stopped %i\n",
info->port.tty->stopped)); info->port.tty->stopped));
e100_disable_serial_tx_ready_irq(info); e100_disable_serial_tx_ready_irq(info);
...@@ -3098,7 +3097,6 @@ rs_flush_chars(struct tty_struct *tty) ...@@ -3098,7 +3097,6 @@ rs_flush_chars(struct tty_struct *tty)
if (info->tr_running || if (info->tr_running ||
info->xmit.head == info->xmit.tail || info->xmit.head == info->xmit.tail ||
tty->stopped || tty->stopped ||
tty->hw_stopped ||
!info->xmit.buf) !info->xmit.buf)
return; return;
...@@ -3176,7 +3174,6 @@ static int rs_raw_write(struct tty_struct *tty, ...@@ -3176,7 +3174,6 @@ static int rs_raw_write(struct tty_struct *tty,
if (info->xmit.head != info->xmit.tail && if (info->xmit.head != info->xmit.tail &&
!tty->stopped && !tty->stopped &&
!tty->hw_stopped &&
!info->tr_running) { !info->tr_running) {
start_transmit(info); start_transmit(info);
} }
...@@ -3733,10 +3730,8 @@ rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios) ...@@ -3733,10 +3730,8 @@ rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
/* Handle turning off CRTSCTS */ /* Handle turning off CRTSCTS */
if ((old_termios->c_cflag & CRTSCTS) && if ((old_termios->c_cflag & CRTSCTS) &&
!(tty->termios.c_cflag & CRTSCTS)) { !(tty->termios.c_cflag & CRTSCTS))
tty->hw_stopped = 0;
rs_start(tty); rs_start(tty);
}
} }
...@@ -4256,9 +4251,6 @@ static void seq_line_info(struct seq_file *m, struct e100_serial *info) ...@@ -4256,9 +4251,6 @@ static void seq_line_info(struct seq_file *m, struct e100_serial *info)
if (info->port.tty->stopped) if (info->port.tty->stopped)
seq_printf(m, " stopped:%i", seq_printf(m, " stopped:%i",
(int)info->port.tty->stopped); (int)info->port.tty->stopped);
if (info->port.tty->hw_stopped)
seq_printf(m, " hw_stopped:%i",
(int)info->port.tty->hw_stopped);
} }
{ {
......
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