static irqreturn_t bfin_serial_mctrl_cts_int(int irq, void *dev_id)
{
struct bfin_serial_port *uart = dev_id;
- unsigned int status = bfin_serial_get_mctrl(&uart->port);
+ struct uart_port *uport = &uart->port;
+ unsigned int status = bfin_serial_get_mctrl(uport);
#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
- struct tty_struct *tty = uart->port.state->port.tty;
UART_CLEAR_SCTS(uart);
- if (tty->hw_stopped) {
+ if (uport->hw_stopped) {
if (status) {
- tty->hw_stopped = 0;
- uart_write_wakeup(&uart->port);
+ uport->hw_stopped = 0;
+ uart_write_wakeup(uport);
}
} else {
if (!status)
- tty->hw_stopped = 1;
+ uport->hw_stopped = 1;
}
#endif
- uart_handle_cts_change(&uart->port, status & TIOCM_CTS);
+ uart_handle_cts_change(uport, status & TIOCM_CTS);
return IRQ_HANDLED;
}
struct uart_state *state = tty->driver_data;
struct uart_port *port = state->uart_port;
- if (!tty->stopped && !tty->hw_stopped)
+ if (!uart_tx_stopped(port))
port->ops->start_tx(port);
}
}
spin_lock_irq(&uport->lock);
- if (uart_cts_enabled(uport)) {
- if (!(uport->ops->get_mctrl(uport) & TIOCM_CTS))
- tty->hw_stopped = 1;
- }
+ if (uart_cts_enabled(uport) &&
+ !(uport->ops->get_mctrl(uport) & TIOCM_CTS))
+ uport->hw_stopped = 1;
+ else
+ uport->hw_stopped = 0;
spin_unlock_irq(&uport->lock);
}
*/
if (uport->x_char ||
((uart_circ_chars_pending(&state->xmit) > 0) &&
- !tty->stopped && !tty->hw_stopped))
+ !uart_tx_stopped(uport)))
result &= ~TIOCSER_TEMT;
return put_user(result, value);
/*
* If the port is doing h/w assisted flow control, do nothing.
- * We assume that tty->hw_stopped has never been set.
+ * We assume that port->hw_stopped has never been set.
*/
if (uport->flags & UPF_HARD_FLOW)
return;
/* Handle turning off CRTSCTS */
if ((old_termios->c_cflag & CRTSCTS) && !(cflag & CRTSCTS)) {
spin_lock_irqsave(&uport->lock, flags);
- tty->hw_stopped = 0;
+ uport->hw_stopped = 0;
__uart_start(tty);
spin_unlock_irqrestore(&uport->lock, flags);
}
else if (!(old_termios->c_cflag & CRTSCTS) && (cflag & CRTSCTS)) {
spin_lock_irqsave(&uport->lock, flags);
if (!(uport->ops->get_mctrl(uport) & TIOCM_CTS)) {
- tty->hw_stopped = 1;
+ uport->hw_stopped = 1;
uport->ops->stop_tx(uport);
}
spin_unlock_irqrestore(&uport->lock, flags);
*/
void uart_handle_cts_change(struct uart_port *uport, unsigned int status)
{
- struct tty_port *port = &uport->state->port;
- struct tty_struct *tty = port->tty;
-
lockdep_assert_held_once(&uport->lock);
uport->icount.cts++;
if (uart_cts_enabled(uport)) {
- if (tty->hw_stopped) {
+ if (uport->hw_stopped) {
if (status) {
- tty->hw_stopped = 0;
+ uport->hw_stopped = 0;
uport->ops->start_tx(uport);
uart_write_wakeup(uport);
}
} else {
if (!status) {
- tty->hw_stopped = 1;
+ uport->hw_stopped = 1;
uport->ops->stop_tx(uport);
}
}
#define UPSTAT_CTS_ENABLE ((__force upstat_t) (1 << 0))
#define UPSTAT_DCD_ENABLE ((__force upstat_t) (1 << 1))
+ int hw_stopped; /* sw-assisted CTS flow state */
unsigned int mctrl; /* current modem ctrl settings */
unsigned int timeout; /* character-based timeout */
unsigned int type; /* port type */
static inline int uart_tx_stopped(struct uart_port *port)
{
struct tty_struct *tty = port->state->port.tty;
- if(tty->stopped || tty->hw_stopped)
+ if (tty->stopped || port->hw_stopped)
return 1;
return 0;
}