Skip to content

Commit

Permalink
powerpc: Improve prom_printf()
Browse files Browse the repository at this point in the history
Adds the ability to print decimal numbers and adds some more
format string variants

Signed-off-by: Benjamin Herrenschmidt <[email protected]>
  • Loading branch information
ozbenh committed Apr 20, 2011
1 parent dd79773 commit af27714
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion arch/powerpc/kernel/prom_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ static void __init prom_printf(const char *format, ...)
const char *p, *q, *s;
va_list args;
unsigned long v;
long vs;
struct prom_t *_prom = &RELOC(prom);

va_start(args, format);
Expand Down Expand Up @@ -368,12 +369,35 @@ static void __init prom_printf(const char *format, ...)
v = va_arg(args, unsigned long);
prom_print_hex(v);
break;
case 'd':
++q;
vs = va_arg(args, int);
if (vs < 0) {
prom_print(RELOC("-"));
vs = -vs;
}
prom_print_dec(vs);
break;
case 'l':
++q;
if (*q == 'u') { /* '%lu' */
if (*q == 0)
break;
else if (*q == 'x') {
++q;
v = va_arg(args, unsigned long);
prom_print_hex(v);
} else if (*q == 'u') { /* '%lu' */
++q;
v = va_arg(args, unsigned long);
prom_print_dec(v);
} else if (*q == 'd') { /* %ld */
++q;
vs = va_arg(args, long);
if (vs < 0) {
prom_print(RELOC("-"));
vs = -vs;
}
prom_print_dec(vs);
}
break;
}
Expand Down

0 comments on commit af27714

Please sign in to comment.