diff mbox series

tty/serial: use uart_console_write in the RISC-V SBL early console

Message ID mvmsgy0cu9g.fsf_-_@suse.de (mailing list archive)
State New, archived
Headers show
Series tty/serial: use uart_console_write in the RISC-V SBL early console | expand

Commit Message

Andreas Schwab Jan. 10, 2019, 5:11 p.m. UTC
This enables proper NLCR processing.

Suggested-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Andreas Schwab <schwab@suse.de>
---
 drivers/tty/serial/earlycon-riscv-sbi.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Anup Patel Jan. 11, 2019, 11:13 a.m. UTC | #1
On Thu, Jan 10, 2019 at 10:41 PM Andreas Schwab <schwab@suse.de> wrote:
>
> This enables proper NLCR processing.
>
> Suggested-by: Anup Patel <anup@brainfault.org>
> Signed-off-by: Andreas Schwab <schwab@suse.de>
> ---
>  drivers/tty/serial/earlycon-riscv-sbi.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/tty/serial/earlycon-riscv-sbi.c b/drivers/tty/serial/earlycon-riscv-sbi.c
> index e1a551aae3..ce81523c31 100644
> --- a/drivers/tty/serial/earlycon-riscv-sbi.c
> +++ b/drivers/tty/serial/earlycon-riscv-sbi.c
> @@ -10,13 +10,16 @@
>  #include <linux/serial_core.h>
>  #include <asm/sbi.h>
>
> -static void sbi_console_write(struct console *con,
> -                             const char *s, unsigned int n)
> +static void sbi_putc(struct uart_port *port, int c)
>  {
> -       int i;
> +       sbi_console_putchar(c);
> +}
>
> -       for (i = 0; i < n; ++i)
> -               sbi_console_putchar(s[i]);
> +static void sbi_console_write(struct console *con,
> +                             const char *s, unsigned n)
> +{
> +       struct earlycon_device *dev = con->data;
> +       uart_console_write(&dev->port, s, n, sbi_putc);
>  }
>
>  static int __init early_sbi_setup(struct earlycon_device *device,
> --
> 2.20.1
>
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."

Looks good to me.

Reviewed-by: Anup Patel <anup@brainfault.org>

Regards,
Anup
Christoph Hellwig Jan. 15, 2019, 1:59 p.m. UTC | #2
On Thu, Jan 10, 2019 at 06:11:39PM +0100, Andreas Schwab wrote:
> This enables proper NLCR processing.
> 
> Suggested-by: Anup Patel <anup@brainfault.org>
> Signed-off-by: Andreas Schwab <schwab@suse.de>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
Palmer Dabbelt Jan. 23, 2019, 11:58 p.m. UTC | #3
On Fri, 11 Jan 2019 03:13:30 PST (-0800), anup@brainfault.org wrote:
> On Thu, Jan 10, 2019 at 10:41 PM Andreas Schwab <schwab@suse.de> wrote:
>>
>> This enables proper NLCR processing.
>>
>> Suggested-by: Anup Patel <anup@brainfault.org>
>> Signed-off-by: Andreas Schwab <schwab@suse.de>
>> ---
>>  drivers/tty/serial/earlycon-riscv-sbi.c | 13 ++++++++-----
>>  1 file changed, 8 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/tty/serial/earlycon-riscv-sbi.c b/drivers/tty/serial/earlycon-riscv-sbi.c
>> index e1a551aae3..ce81523c31 100644
>> --- a/drivers/tty/serial/earlycon-riscv-sbi.c
>> +++ b/drivers/tty/serial/earlycon-riscv-sbi.c
>> @@ -10,13 +10,16 @@
>>  #include <linux/serial_core.h>
>>  #include <asm/sbi.h>
>>
>> -static void sbi_console_write(struct console *con,
>> -                             const char *s, unsigned int n)
>> +static void sbi_putc(struct uart_port *port, int c)
>>  {
>> -       int i;
>> +       sbi_console_putchar(c);
>> +}
>>
>> -       for (i = 0; i < n; ++i)
>> -               sbi_console_putchar(s[i]);
>> +static void sbi_console_write(struct console *con,
>> +                             const char *s, unsigned n)
>> +{
>> +       struct earlycon_device *dev = con->data;
>> +       uart_console_write(&dev->port, s, n, sbi_putc);
>>  }
>>
>>  static int __init early_sbi_setup(struct earlycon_device *device,
>> --
>> 2.20.1
>>
>> --
>> Andreas Schwab, SUSE Labs, schwab@suse.de
>> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
>> "And now for something completely different."
>
> Looks good to me.
>
> Reviewed-by: Anup Patel <anup@brainfault.org>
>
> Regards,
> Anup

Thanks.  I'm going to include this in my next PR, as it's pretty self contained 
and is necessary to actually use this sanely.
diff mbox series

Patch

diff --git a/drivers/tty/serial/earlycon-riscv-sbi.c b/drivers/tty/serial/earlycon-riscv-sbi.c
index e1a551aae3..ce81523c31 100644
--- a/drivers/tty/serial/earlycon-riscv-sbi.c
+++ b/drivers/tty/serial/earlycon-riscv-sbi.c
@@ -10,13 +10,16 @@ 
 #include <linux/serial_core.h>
 #include <asm/sbi.h>
 
-static void sbi_console_write(struct console *con,
-			      const char *s, unsigned int n)
+static void sbi_putc(struct uart_port *port, int c)
 {
-	int i;
+	sbi_console_putchar(c);
+}
 
-	for (i = 0; i < n; ++i)
-		sbi_console_putchar(s[i]);
+static void sbi_console_write(struct console *con,
+			      const char *s, unsigned n)
+{
+	struct earlycon_device *dev = con->data;
+	uart_console_write(&dev->port, s, n, sbi_putc);
 }
 
 static int __init early_sbi_setup(struct earlycon_device *device,