]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
serial: st-asc: Fix SysRq char handling
authorDaniel Thompson <daniel.thompson@linaro.org>
Fri, 28 Mar 2014 10:53:10 +0000 (10:53 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Apr 2014 21:17:44 +0000 (14:17 -0700)
This driver, like several others, uses the upper bits of the character
to track both real and dummy state. Unfortunately it neglects to mask
these bits properly when passing the character data around. This means
neither break detection nor sysrq character handling work correctly.

This patch adds the requires masking and has been tested to confirm
that it correctly handles magic sysrq sequences on ST's B2020 board.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/st-asc.c

index 21e6e84c0df872a97dbaae1d84ab433cce18411d..dd3a96e070265d6ab7e32782cbe24e47622b2965 100644 (file)
@@ -295,7 +295,7 @@ static void asc_receive_chars(struct uart_port *port)
                        status & ASC_STA_OE) {
 
                        if (c & ASC_RXBUF_FE) {
-                               if (c == ASC_RXBUF_FE) {
+                               if (c == (ASC_RXBUF_FE | ASC_RXBUF_DUMMY_RX)) {
                                        port->icount.brk++;
                                        if (uart_handle_break(port))
                                                continue;
@@ -325,7 +325,7 @@ static void asc_receive_chars(struct uart_port *port)
                                flag = TTY_FRAME;
                }
 
-               if (uart_handle_sysrq_char(port, c))
+               if (uart_handle_sysrq_char(port, c & 0xff))
                        continue;
 
                uart_insert_char(port, c, ASC_RXBUF_DUMMY_OE, c & 0xff, flag);