From patchwork Mon Apr 21 17:06:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 4025771 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A994FBFF02 for ; Mon, 21 Apr 2014 17:07:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 938132024C for ; Mon, 21 Apr 2014 17:07:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 817F420221 for ; Mon, 21 Apr 2014 17:07:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752746AbaDURH0 (ORCPT ); Mon, 21 Apr 2014 13:07:26 -0400 Received: from mail-ie0-f202.google.com ([209.85.223.202]:59547 "EHLO mail-ie0-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752654AbaDURHY (ORCPT ); Mon, 21 Apr 2014 13:07:24 -0400 Received: by mail-ie0-f202.google.com with SMTP id lx4so911338iec.3 for ; Mon, 21 Apr 2014 10:07:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ctHFTaScIP60bU5xBZLjZ7WZcSojACU9HytYgYuozrs=; b=I852jgSUY879rwjlgmAoV3qiz3AdqIOwP1JwsHw1ppHnXGVxdLnXNLCHixEpXbY1wG suarODDcDDY7M/IO0WP+M5TqXgdeMTdA8N/yai527rCmLkRXjbKBM4NFFbudrswgMxgq rYaIwNKrmi/BZ/Hj68TCv1qcA89wuyCt+WZqT83VUZATsDuIBrZ8246ykQdrjFPXuaAg kILFHVMnDLUuncz3qIciJqWckZXWdULzV2KxfZmK47Z97eRLdqOxz7Y+Aj65nYIaO/ia 1x7/YLTAmiivJhJXdqqxGlySFCg20WABsfWIak/f9pCoUNhuSyyys8lerxpQaFari+J/ tOJg== X-Gm-Message-State: ALoCoQmlRyp18zU8D01EpvXvM5yJxPb7qGB103DStQY8TsCldwxNhKkR2IBm/dONCHOEe6YpgOT6GaMJPyj0/3a+EEBzQCkZREJyM3C7Cd1fCfsXcXF5N8DsZmXMzcZGjJ++tv0scNZ6rIeuk19tzDkt2zfJ2oZpKyJgXARXo1QVdBfRNLYJmqpTJWPyjulGxTwnlGIQZ2/SJnJOoaIzJNSLjGVcfmUzTQ== X-Received: by 10.42.123.66 with SMTP id q2mr14649910icr.16.1398100044350; Mon, 21 Apr 2014 10:07:24 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id x22si5243711yhd.5.2014.04.21.10.07.24 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Apr 2014 10:07:24 -0700 (PDT) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.72.141]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 1117831C1C9; Mon, 21 Apr 2014 10:07:24 -0700 (PDT) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id AECC680745; Mon, 21 Apr 2014 10:07:23 -0700 (PDT) From: Doug Anderson To: Greg Kroah-Hartman Cc: Jason Wessel , linux-samsung-soc@vger.kernel.org, olof@lixom.net, Doug Anderson , jslaby@suse.cz, paul.gortmaker@windriver.com, jg1.han@samsung.com, asierra@xes-inc.com, swarren@nvidia.com, heikki.krogerus@linux.intel.com, jschultz@xes-inc.com, kyle@infradead.org, mingo@elte.hu, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] serial_core: Commonalize crlf when working w/ a non open console port Date: Mon, 21 Apr 2014 10:06:43 -0700 Message-Id: <1398100003-4172-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 1.9.1.423.g4596e3a In-Reply-To: <1397841448-12942-1-git-send-email-dianders@chromium.org> References: <1397841448-12942-1-git-send-email-dianders@chromium.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- Changes in v2: - Moved from kdb to serial_core drivers/tty/serial/8250/8250_core.c | 5 ----- drivers/tty/serial/pch_uart.c | 5 ----- drivers/tty/serial/pxa.c | 5 ----- drivers/tty/serial/serial_core.c | 3 +++ drivers/tty/serial/serial_txx9.c | 5 ----- 5 files changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 81f909c..ffee982 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -1926,13 +1926,8 @@ static void serial8250_put_poll_char(struct uart_port *port, wait_for_xmitr(up, BOTH_EMPTY); /* * Send the character out. - * If a LF, also do CR... */ serial_port_out(port, UART_TX, c); - if (c == 10) { - wait_for_xmitr(up, BOTH_EMPTY); - serial_port_out(port, UART_TX, 13); - } /* * Finally, wait for transmitter to become empty diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 0931b3f..11e631d 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -1588,13 +1588,8 @@ static void pch_uart_put_poll_char(struct uart_port *port, wait_for_xmitr(priv, UART_LSR_THRE); /* * Send the character out. - * If a LF, also do CR... */ iowrite8(c, priv->membase + PCH_UART_THR); - if (c == 10) { - wait_for_xmitr(priv, UART_LSR_THRE); - iowrite8(13, priv->membase + PCH_UART_THR); - } /* * Finally, wait for transmitter to become empty diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c index f9f20f3..9e7ee39 100644 --- a/drivers/tty/serial/pxa.c +++ b/drivers/tty/serial/pxa.c @@ -711,13 +711,8 @@ static void serial_pxa_put_poll_char(struct uart_port *port, wait_for_xmitr(up); /* * Send the character out. - * If a LF, also do CR... */ serial_out(up, UART_TX, c); - if (c == 10) { - wait_for_xmitr(up); - serial_out(up, UART_TX, 13); - } /* * Finally, wait for transmitter to become empty diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index f26834d..5dba976 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 diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c index 90a080b..60f49b9 100644 --- a/drivers/tty/serial/serial_txx9.c +++ b/drivers/tty/serial/serial_txx9.c @@ -535,13 +535,8 @@ static void serial_txx9_put_poll_char(struct uart_port *port, unsigned char c) wait_for_xmitr(up); /* * Send the character out. - * If a LF, also do CR... */ sio_out(up, TXX9_SITFIFO, c); - if (c == 10) { - wait_for_xmitr(up); - sio_out(up, TXX9_SITFIFO, 13); - } /* * Finally, wait for transmitter to become empty