[PATCH] ppc64: Clean up CR handling
Anton Blanchard
anton at samba.org
Tue Sep 6 11:55:00 EST 2005
From: Milton Miller <miltonm at bga.com>
Make the 16550 and real mode 16550 use tail recursion like the scc code
instead of repeating the routine except for the character sent.
Gcc recoginizes the tail recursion and handles it efficently without
stack allocations. The maple real putc shrinks from 188 to 104 bytes
of instructions. udbg_putc drops from 188 to 140 bytes.
Signed-off-by: Milton Miller <miltonm at bga.com>
Signed-off-by: Anton Blanchard <anton at samba.org>
Index: build/arch/ppc64/kernel/udbg.c
===================================================================
--- build.orig/arch/ppc64/kernel/udbg.c 2005-09-05 20:29:29.000000000 +1000
+++ build/arch/ppc64/kernel/udbg.c 2005-09-05 20:29:38.000000000 +1000
@@ -169,12 +169,8 @@
while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
/* wait for idle */;
real_writeb(c, &udbg_comport->thr); eieio();
- if (c == '\n') {
- /* Also put a CR. This is for convenience. */
- while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
- /* wait for idle */;
- real_writeb('\r', &udbg_comport->thr); eieio();
- }
+ if (c == '\n')
+ udbg_maple_real_putc('\r');
}
}
@@ -194,12 +190,8 @@
while ((in_8(&udbg_comport->lsr) & LSR_THRE) == 0)
/* wait for idle */;
out_8(&udbg_comport->thr, c);
- if (c == '\n') {
- /* Also put a CR. This is for convenience. */
- while ((in_8(&udbg_comport->lsr) & LSR_THRE) == 0)
- /* wait for idle */;
- out_8(&udbg_comport->thr, '\r');
- }
+ if (c == '\n')
+ udbg_putc('\r');
}
#ifdef CONFIG_PPC_PMAC
else if (sccc) {
More information about the Linuxppc64-dev
mailing list