Skip to content

Commit f503b16

Browse files
avpatelpalmer-dabbelt
authored andcommitted
RISC-V: Add stubs for sbi_console_putchar/getchar()
The functions sbi_console_putchar() and sbi_console_getchar() are not defined when CONFIG_RISCV_SBI_V01 is disabled so let us add stub of these functions to avoid "#ifdef" on user side. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent b85ea95 commit f503b16

File tree

1 file changed

+5
-0
lines changed
  • arch/riscv/include/asm

1 file changed

+5
-0
lines changed

arch/riscv/include/asm/sbi.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,13 @@ struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
271271
unsigned long arg3, unsigned long arg4,
272272
unsigned long arg5);
273273

274+
#ifdef CONFIG_RISCV_SBI_V01
274275
void sbi_console_putchar(int ch);
275276
int sbi_console_getchar(void);
277+
#else
278+
static inline void sbi_console_putchar(int ch) { }
279+
static inline int sbi_console_getchar(void) { return -ENOENT; }
280+
#endif
276281
long sbi_get_mvendorid(void);
277282
long sbi_get_marchid(void);
278283
long sbi_get_mimpid(void);

0 commit comments

Comments
 (0)