diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-04-05 20:51:17 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-04-19 21:03:25 -0400 |
commit | af2771493a1bf79cd9a1ab4f30327c428b5bd67c (patch) | |
tree | 59016ca742c666ef09ec6f2af517ffeafd6ea58c /arch/powerpc/kernel/prom_init.c | |
parent | dd797738643cd3c2dd9cdff7e4c3a04d318ab23a (diff) |
powerpc: Improve prom_printf()
Adds the ability to print decimal numbers and adds some more
format string variants
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/prom_init.c')
-rw-r--r-- | arch/powerpc/kernel/prom_init.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 941ff4dbc567..7839bd7bfd15 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -335,6 +335,7 @@ static void __init prom_printf(const char *format, ...) | |||
335 | const char *p, *q, *s; | 335 | const char *p, *q, *s; |
336 | va_list args; | 336 | va_list args; |
337 | unsigned long v; | 337 | unsigned long v; |
338 | long vs; | ||
338 | struct prom_t *_prom = &RELOC(prom); | 339 | struct prom_t *_prom = &RELOC(prom); |
339 | 340 | ||
340 | va_start(args, format); | 341 | va_start(args, format); |
@@ -368,12 +369,35 @@ static void __init prom_printf(const char *format, ...) | |||
368 | v = va_arg(args, unsigned long); | 369 | v = va_arg(args, unsigned long); |
369 | prom_print_hex(v); | 370 | prom_print_hex(v); |
370 | break; | 371 | break; |
372 | case 'd': | ||
373 | ++q; | ||
374 | vs = va_arg(args, int); | ||
375 | if (vs < 0) { | ||
376 | prom_print(RELOC("-")); | ||
377 | vs = -vs; | ||
378 | } | ||
379 | prom_print_dec(vs); | ||
380 | break; | ||
371 | case 'l': | 381 | case 'l': |
372 | ++q; | 382 | ++q; |
373 | if (*q == 'u') { /* '%lu' */ | 383 | if (*q == 0) |
384 | break; | ||
385 | else if (*q == 'x') { | ||
386 | ++q; | ||
387 | v = va_arg(args, unsigned long); | ||
388 | prom_print_hex(v); | ||
389 | } else if (*q == 'u') { /* '%lu' */ | ||
374 | ++q; | 390 | ++q; |
375 | v = va_arg(args, unsigned long); | 391 | v = va_arg(args, unsigned long); |
376 | prom_print_dec(v); | 392 | prom_print_dec(v); |
393 | } else if (*q == 'd') { /* %ld */ | ||
394 | ++q; | ||
395 | vs = va_arg(args, long); | ||
396 | if (vs < 0) { | ||
397 | prom_print(RELOC("-")); | ||
398 | vs = -vs; | ||
399 | } | ||
400 | prom_print_dec(vs); | ||
377 | } | 401 | } |
378 | break; | 402 | break; |
379 | } | 403 | } |