mirror of https://gitee.com/openkylin/linux.git
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: Qian Cai <cai@lca.pw> [mpe: Split out of larger patch, write change log] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
cd1d55f16d
commit
f7a678a8fa
|
@ -120,6 +120,7 @@ int udbg_write(const char *s, int n)
|
|||
#define UDBG_BUFSIZE 256
|
||||
void udbg_printf(const char *fmt, ...)
|
||||
{
|
||||
if (udbg_putc) {
|
||||
char buf[UDBG_BUFSIZE];
|
||||
va_list args;
|
||||
|
||||
|
@ -127,6 +128,7 @@ void udbg_printf(const char *fmt, ...)
|
|||
vsnprintf(buf, UDBG_BUFSIZE, fmt, args);
|
||||
udbg_puts(buf);
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
|
||||
void __init udbg_progress(char *s, unsigned short hex)
|
||||
|
|
Loading…
Reference in New Issue