Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: sh-sci: fix break handling for sysrq

This fixes two issues that cause the sysrq sequence to be inadvertently
aborted on SCIF serial consoles:

- a NUL character remains in the RX queue after a break has been detected,
which is then passed on to uart_handle_sysrq_char()
- the break interrupt is handled twice on controllers with multiplexed ERI
and BRI interrupts

Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
Link: https://lore.kernel.org/r/20210816162201.28801-1-uli+renesas@fpond.eu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ulrich Hecht and committed by
Greg Kroah-Hartman
87b8061b 3d881e32

+6 -1
+6 -1
drivers/tty/serial/sh-sci.c
··· 1758 1758 1759 1759 /* Handle BREAKs */ 1760 1760 sci_handle_breaks(port); 1761 + 1762 + /* drop invalid character received before break was detected */ 1763 + serial_port_in(port, SCxRDR); 1764 + 1761 1765 sci_clear_SCxSR(port, SCxSR_BREAK_CLEAR(port)); 1762 1766 1763 1767 return IRQ_HANDLED; ··· 1841 1837 ret = sci_er_interrupt(irq, ptr); 1842 1838 1843 1839 /* Break Interrupt */ 1844 - if ((ssr_status & SCxSR_BRK(port)) && err_enabled) 1840 + if (s->irqs[SCIx_ERI_IRQ] != s->irqs[SCIx_BRI_IRQ] && 1841 + (ssr_status & SCxSR_BRK(port)) && err_enabled) 1845 1842 ret = sci_br_interrupt(irq, ptr); 1846 1843 1847 1844 /* Overrun Interrupt */