From c7d44a02ac606c2bebf90751deebec2321379d6d Mon Sep 17 00:00:00 2001 From: Doug Anderson Date: Mon, 21 Apr 2014 10:06:43 -0700 Subject: serial_core: Commonalize crlf when working w/ a non open console port In (efe2f29 kgdboc,kdb: Allow kdb to work on a non open console port) support was added to directly use the "write_char" functions when doing kdb over a non-open console port. This is great, but it ends up bypassing the normal code in uart_console_write() that adds a carriage return before any newlines. There appears to have been a trend to add this support directly in some console driver's poll_put_char() functions. This had a few side effects, including: - In this case we were doing LFCR, not CRLF. This was fixed in uart_console_write() back in (d358788 [SERIAL] kernel console should send CRLF not LFCR) - Not all serial drivers had the LFCR code in their poll_put_char() functions. In my case I was running serial/samsung.c which lacked it. I've moved the handling to uart_poll_put_char() to fix the above problems. Now when I use kdb (and don't point console= to the same UART) I no longer get: [0]kdb> [0]kdb> [0]kdb> Signed-off-by: Doug Anderson Reviewed-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/serial_core.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/tty/serial/serial_core.c') diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index f26834d262b3..5dba9766f626 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2236,6 +2236,9 @@ static void uart_poll_put_char(struct tty_driver *driver, int line, char ch) return; port = state->uart_port; + + if (ch == '\n') + port->ops->poll_put_char(port, '\r'); port->ops->poll_put_char(port, ch); } #endif -- cgit v1.2.3-59-g8ed1b