Skip to content

Commit

Permalink
serial: core: Use spin_lock_irq() in uart_set_termios()
Browse files Browse the repository at this point in the history
uart_set_termios() is called with interrupts enabled; no need to
save and restore the interrupt state when taking the uart port lock.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Hurley authored and Greg Kroah-Hartman committed Sep 24, 2014
1 parent 8620d3e commit 938f7e1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/tty/serial/serial_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,6 @@ static void uart_set_termios(struct tty_struct *tty,
{
struct uart_state *state = tty->driver_data;
struct uart_port *uport = state->uart_port;
unsigned long flags;
unsigned int cflag = tty->termios.c_cflag;
unsigned int iflag_mask = IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK;
bool sw_changed = false;
Expand Down Expand Up @@ -1303,19 +1302,19 @@ static void uart_set_termios(struct tty_struct *tty,

/* Handle turning off CRTSCTS */
if ((old_termios->c_cflag & CRTSCTS) && !(cflag & CRTSCTS)) {
spin_lock_irqsave(&uport->lock, flags);
spin_lock_irq(&uport->lock);
uport->hw_stopped = 0;
__uart_start(tty);
spin_unlock_irqrestore(&uport->lock, flags);
spin_unlock_irq(&uport->lock);
}
/* Handle turning on CRTSCTS */
else if (!(old_termios->c_cflag & CRTSCTS) && (cflag & CRTSCTS)) {
spin_lock_irqsave(&uport->lock, flags);
spin_lock_irq(&uport->lock);
if (!(uport->ops->get_mctrl(uport) & TIOCM_CTS)) {
uport->hw_stopped = 1;
uport->ops->stop_tx(uport);
}
spin_unlock_irqrestore(&uport->lock, flags);
spin_unlock_irq(&uport->lock);
}
}

Expand Down

0 comments on commit 938f7e1

Please sign in to comment.