diff mbox series

[2/2] lib: utils/serial: remove semihosting_putc

Message ID 20231117010440.105759-2-wxjstz@126.com
State Accepted
Headers show
Series [1/2] lib: sbi: Make console_puts/console_putc interchangeable | expand

Commit Message

Xiang W Nov. 17, 2023, 1:03 a.m. UTC
For some debuggers that do not implement SYSWRITEC and SYSREADC
operations, we can use SYSWRITE and SYSREAD instead like the
implementation of semihosting_putc(). This makes
semihosting_putc/semihosting_puts similar. Since
console_putc/console_puts are now interchangeable, removing the
semihosting_putc.

Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
Signed-off-by: Xiang W <wxjstz@126.com>
Reviewed-by: Guo Ren <guoren@kerenl.org>
---
 lib/utils/serial/semihosting.c | 6 ------
 1 file changed, 6 deletions(-)

Comments

Anup Patel Nov. 17, 2023, 10:30 a.m. UTC | #1
On Fri, Nov 17, 2023 at 6:34 AM Xiang W <wxjstz@126.com> wrote:
>
> For some debuggers that do not implement SYSWRITEC and SYSREADC
> operations, we can use SYSWRITE and SYSREAD instead like the
> implementation of semihosting_putc(). This makes
> semihosting_putc/semihosting_puts similar. Since
> console_putc/console_puts are now interchangeable, removing the
> semihosting_putc.

This commit description needs to be re-written. I have taken care at
the time of merging this patch.

>
> Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
> Signed-off-by: Xiang W <wxjstz@126.com>
> Reviewed-by: Guo Ren <guoren@kerenl.org>

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

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

> ---
>  lib/utils/serial/semihosting.c | 6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/lib/utils/serial/semihosting.c b/lib/utils/serial/semihosting.c
> index a27c69e..19ebaa0 100644
> --- a/lib/utils/serial/semihosting.c
> +++ b/lib/utils/serial/semihosting.c
> @@ -178,11 +178,6 @@ static unsigned long semihosting_puts(const char *str, unsigned long len)
>         return (ret < 0) ? 0 : ret;
>  }
>
> -static void semihosting_putc(char ch)
> -{
> -       semihosting_puts(&ch, 1);
> -}
> -
>  static int semihosting_getc(void)
>  {
>         char ch = 0;
> @@ -199,7 +194,6 @@ static int semihosting_getc(void)
>
>  static struct sbi_console_device semihosting_console = {
>         .name = "semihosting",
> -       .console_putc = semihosting_putc,
>         .console_puts = semihosting_puts,
>         .console_getc = semihosting_getc
>  };
> --
> 2.42.0
>
diff mbox series

Patch

diff --git a/lib/utils/serial/semihosting.c b/lib/utils/serial/semihosting.c
index a27c69e..19ebaa0 100644
--- a/lib/utils/serial/semihosting.c
+++ b/lib/utils/serial/semihosting.c
@@ -178,11 +178,6 @@  static unsigned long semihosting_puts(const char *str, unsigned long len)
 	return (ret < 0) ? 0 : ret;
 }
 
-static void semihosting_putc(char ch)
-{
-	semihosting_puts(&ch, 1);
-}
-
 static int semihosting_getc(void)
 {
 	char ch = 0;
@@ -199,7 +194,6 @@  static int semihosting_getc(void)
 
 static struct sbi_console_device semihosting_console = {
 	.name = "semihosting",
-	.console_putc = semihosting_putc,
 	.console_puts = semihosting_puts,
 	.console_getc = semihosting_getc
 };