Skip to content

Commit

Permalink
tty/serial: at91: BUG: disable interrupts when !UART_ENABLE_MS()
Browse files Browse the repository at this point in the history
In set_termios(), interrupts where not disabled if UART_ENABLE_MS() was
false.

Tested on at91sam9g35.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Cc: stable <stable@vger.kernel.org> # >= 3.16
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Richard Genoud authored and Greg Kroah-Hartman committed Sep 8, 2014
1 parent f174442 commit 35b675b
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion drivers/tty/serial/atmel_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,45 @@ static void atmel_enable_ms(struct uart_port *port)
UART_PUT_IER(port, ier);
}

/*
* Disable modem status interrupts
*/
static void atmel_disable_ms(struct uart_port *port)
{
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
uint32_t idr = 0;

/*
* Interrupt should not be disabled twice
*/
if (!atmel_port->ms_irq_enabled)
return;

atmel_port->ms_irq_enabled = false;

if (atmel_port->gpio_irq[UART_GPIO_CTS] >= 0)
disable_irq(atmel_port->gpio_irq[UART_GPIO_CTS]);
else
idr |= ATMEL_US_CTSIC;

if (atmel_port->gpio_irq[UART_GPIO_DSR] >= 0)
disable_irq(atmel_port->gpio_irq[UART_GPIO_DSR]);
else
idr |= ATMEL_US_DSRIC;

if (atmel_port->gpio_irq[UART_GPIO_RI] >= 0)
disable_irq(atmel_port->gpio_irq[UART_GPIO_RI]);
else
idr |= ATMEL_US_RIIC;

if (atmel_port->gpio_irq[UART_GPIO_DCD] >= 0)
disable_irq(atmel_port->gpio_irq[UART_GPIO_DCD]);
else
idr |= ATMEL_US_DCDIC;

UART_PUT_IDR(port, idr);
}

/*
* Control the transmission of a break signal
*/
Expand Down Expand Up @@ -1993,7 +2032,9 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,

/* CTS flow-control and modem-status interrupts */
if (UART_ENABLE_MS(port, termios->c_cflag))
port->ops->enable_ms(port);
atmel_enable_ms(port);
else
atmel_disable_ms(port);

spin_unlock_irqrestore(&port->lock, flags);
}
Expand Down

0 comments on commit 35b675b

Please sign in to comment.