Commit f7a678a8 authored by Michael Ellerman's avatar Michael Ellerman

powerpc/udbg: Make it safe to call udbg_printf() always

Make udbg_printf() check if udbg_putc is set, and if not just return.
This makes it safe to call udbg_printf() anytime, even when a udbg
backend has not been registered, which means we can avoid some ifdefs
at call sites.
Signed-off-by: default avatarQian Cai <cai@lca.pw>
[mpe: Split out of larger patch, write change log]
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent cd1d55f1
...@@ -120,13 +120,15 @@ int udbg_write(const char *s, int n) ...@@ -120,13 +120,15 @@ int udbg_write(const char *s, int n)
#define UDBG_BUFSIZE 256 #define UDBG_BUFSIZE 256
void udbg_printf(const char *fmt, ...) void udbg_printf(const char *fmt, ...)
{ {
char buf[UDBG_BUFSIZE]; if (udbg_putc) {
va_list args; char buf[UDBG_BUFSIZE];
va_list args;
va_start(args, fmt); va_start(args, fmt);
vsnprintf(buf, UDBG_BUFSIZE, fmt, args); vsnprintf(buf, UDBG_BUFSIZE, fmt, args);
udbg_puts(buf); udbg_puts(buf);
va_end(args); va_end(args);
}
} }
void __init udbg_progress(char *s, unsigned short hex) void __init udbg_progress(char *s, unsigned short hex)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment