Convert PSCI debug facilities to use shared code in lib/console.c, similar to what's been done to PBL_CONSOLE. Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx> --- arch/arm/cpu/psci.c | 34 +++++++--------------------------- arch/arm/include/asm/psci.h | 11 ----------- 2 files changed, 7 insertions(+), 38 deletions(-) diff --git a/arch/arm/cpu/psci.c b/arch/arm/cpu/psci.c index ad132c0a3..435ec92cc 100644 --- a/arch/arm/cpu/psci.c +++ b/arch/arm/cpu/psci.c @@ -33,35 +33,15 @@ * warned. */ -static putc_func_t __putc; -static void *putc_ctx; +static void __console_psci_putc(struct console_device *cdev, char c) {} -void psci_set_putc(putc_func_t putcf, void *ctx) -{ - __putc = putcf; - putc_ctx = ctx; -} - -void psci_putc(char c) -{ - if (__putc) - __putc(putc_ctx, c); -} +static struct console_device console_psci = { + .putc = __console_psci_putc, +}; -int psci_puts(const char *str) +void psci_set_putc(putc_func_t putcf, void *ctx) { - int n = 0; - - while (*str) { - if (*str == '\n') - psci_putc('\r'); - - psci_putc(*str); - str++; - n++; - } - - return n; + __console_set_putc(&console_psci, putcf, ctx); } int psci_printf(const char *fmt, ...) @@ -74,7 +54,7 @@ int psci_printf(const char *fmt, ...) i = vsprintf(printbuffer, fmt, args); va_end(args); - psci_puts(printbuffer); + __console_puts(&console_psci, printbuffer); return i; } diff --git a/arch/arm/include/asm/psci.h b/arch/arm/include/asm/psci.h index e0c452538..d2b40907f 100644 --- a/arch/arm/include/asm/psci.h +++ b/arch/arm/include/asm/psci.h @@ -110,8 +110,6 @@ void psci_cpu_entry(void); #ifdef CONFIG_ARM_PSCI_DEBUG void psci_set_putc(void (*putcf)(void *ctx, int c), void *ctx); -void psci_putc(char c); -int psci_puts(const char *str); int psci_printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); #else @@ -120,15 +118,6 @@ static inline void psci_set_putc(void (*putcf)(void *ctx, int c), void *ctx) { } -static inline void psci_putc(char c) -{ -} - -static inline int psci_puts(const char *str) -{ - return 0; -} - static inline int psci_printf(const char *fmt, ...) { return 0; -- 2.17.0 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox