linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: altera_jtaguart: Adpot uart_console_write()
@ 2014-07-15 15:26 Tobias Klauser
  2014-07-15 15:52 ` Daniel Thompson
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Klauser @ 2014-07-15 15:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Jiri Slaby, linux-serial, nios2-dev, Daniel Thompson

Follow commit 2970b7f5ea3c ("serial: altera: Adopt
uart_console_write()") and don't open code the LF to LFCR conversion in
altera_jtaguart either. Use uart_console_write() instead.

Cc: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/tty/serial/altera_jtaguart.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c
index e7d1aaf..afe2e75 100644
--- a/drivers/tty/serial/altera_jtaguart.c
+++ b/drivers/tty/serial/altera_jtaguart.c
@@ -304,7 +304,7 @@ static struct altera_jtaguart altera_jtaguart_ports[ALTERA_JTAGUART_MAXPORTS];
 #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE)
 
 #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE_BYPASS)
-static void altera_jtaguart_console_putc(struct console *co, const char c)
+static void altera_jtaguart_console_putc(struct console *co, int c)
 {
 	struct uart_port *port = &(altera_jtaguart_ports + co->index)->port;
 	unsigned long status;
@@ -325,7 +325,7 @@ static void altera_jtaguart_console_putc(struct console *co, const char c)
 	spin_unlock_irqrestore(&port->lock, flags);
 }
 #else
-static void altera_jtaguart_console_putc(struct console *co, const char c)
+static void altera_jtaguart_console_putc(struct console *co, int c)
 {
 	struct uart_port *port = &(altera_jtaguart_ports + co->index)->port;
 	unsigned long flags;
@@ -345,11 +345,9 @@ static void altera_jtaguart_console_putc(struct console *co, const char c)
 static void altera_jtaguart_console_write(struct console *co, const char *s,
 					  unsigned int count)
 {
-	for (; count; count--, s++) {
-		altera_jtaguart_console_putc(co, *s);
-		if (*s == '\n')
-			altera_jtaguart_console_putc(co, '\r');
-	}
+	struct uart_port *port = &(altera_jtaguart_ports + co->index)->port;
+
+	uart_console_write(port, s, count, altera_jtaguart_console_putc);
 }
 
 static int __init altera_jtaguart_console_setup(struct console *co,
-- 
2.0.1



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

* Re: [PATCH] serial: altera_jtaguart: Adpot uart_console_write()
  2014-07-15 15:26 [PATCH] serial: altera_jtaguart: Adpot uart_console_write() Tobias Klauser
@ 2014-07-15 15:52 ` Daniel Thompson
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Thompson @ 2014-07-15 15:52 UTC (permalink / raw)
  To: Tobias Klauser, Greg Kroah-Hartman; +Cc: Jiri Slaby, linux-serial, nios2-dev

On 15/07/14 16:26, Tobias Klauser wrote:
> Follow commit 2970b7f5ea3c ("serial: altera: Adopt
> uart_console_write()") and don't open code the LF to LFCR conversion in
> altera_jtaguart either. Use uart_console_write() instead.

Cool. I just wish I'd remembered to check the other altera drivers myself.

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>


> Cc: Daniel Thompson <daniel.thompson@linaro.org>
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
> ---
>  drivers/tty/serial/altera_jtaguart.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c
> index e7d1aaf..afe2e75 100644
> --- a/drivers/tty/serial/altera_jtaguart.c
> +++ b/drivers/tty/serial/altera_jtaguart.c
> @@ -304,7 +304,7 @@ static struct altera_jtaguart altera_jtaguart_ports[ALTERA_JTAGUART_MAXPORTS];
>  #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE)
>  
>  #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE_BYPASS)
> -static void altera_jtaguart_console_putc(struct console *co, const char c)
> +static void altera_jtaguart_console_putc(struct console *co, int c)
>  {
>  	struct uart_port *port = &(altera_jtaguart_ports + co->index)->port;
>  	unsigned long status;
> @@ -325,7 +325,7 @@ static void altera_jtaguart_console_putc(struct console *co, const char c)
>  	spin_unlock_irqrestore(&port->lock, flags);
>  }
>  #else
> -static void altera_jtaguart_console_putc(struct console *co, const char c)
> +static void altera_jtaguart_console_putc(struct console *co, int c)
>  {
>  	struct uart_port *port = &(altera_jtaguart_ports + co->index)->port;
>  	unsigned long flags;
> @@ -345,11 +345,9 @@ static void altera_jtaguart_console_putc(struct console *co, const char c)
>  static void altera_jtaguart_console_write(struct console *co, const char *s,
>  					  unsigned int count)
>  {
> -	for (; count; count--, s++) {
> -		altera_jtaguart_console_putc(co, *s);
> -		if (*s == '\n')
> -			altera_jtaguart_console_putc(co, '\r');
> -	}
> +	struct uart_port *port = &(altera_jtaguart_ports + co->index)->port;
> +
> +	uart_console_write(port, s, count, altera_jtaguart_console_putc);
>  }
>  
>  static int __init altera_jtaguart_console_setup(struct console *co,
> 


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

end of thread, other threads:[~2014-07-15 15:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-15 15:26 [PATCH] serial: altera_jtaguart: Adpot uart_console_write() Tobias Klauser
2014-07-15 15:52 ` Daniel Thompson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).