All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] serial: st-asc: Fix SysRq char handling
@ 2014-03-28 10:51 Daniel Thompson
  2014-03-28 10:54 ` Daniel Thompson
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Thompson @ 2014-03-28 10:51 UTC (permalink / raw)
  To: daniel.thompson, linux-serial; +Cc: patches, linaro-kernel

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>
---
 drivers/tty/serial/st-asc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index 21e6e84..dd3a96e 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -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);
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] serial: st-asc: Fix SysRq char handling
  2014-03-28 10:51 [PATCH] serial: st-asc: Fix SysRq char handling Daniel Thompson
@ 2014-03-28 10:54 ` Daniel Thompson
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Thompson @ 2014-03-28 10:54 UTC (permalink / raw)
  To: linux-serial

On 28/03/14 10:51, Daniel Thompson wrote:
> 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.

Many apologies but I have posted this patch twice (the first send had a
grossly incomplete Cc: list).

Please ignore the this thread and use the other one.


Daniel.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] serial: st-asc: Fix SysRq char handling
@ 2014-03-28 10:53 Daniel Thompson
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Thompson @ 2014-03-28 10:53 UTC (permalink / raw)
  To: linux-serial
  Cc: patches, linaro-kernel, Daniel Thompson, Greg Kroah-Hartman,
	Jiri Slaby, linux-kernel

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>
---
 drivers/tty/serial/st-asc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index 21e6e84..dd3a96e 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -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);
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-28 10:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-28 10:51 [PATCH] serial: st-asc: Fix SysRq char handling Daniel Thompson
2014-03-28 10:54 ` Daniel Thompson
2014-03-28 10:53 Daniel Thompson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.