tree 68f5365c31beb472c5c4df25fbcb3422cb7d76eb
parent 5fdabaab01ee8928597aae8a0178a3a4f7b66365
author Milton Miller <[EMAIL PROTECTED]> Tue, 06 Sep 2005 11:55:00 +1000
committer Paul Mackerras <[EMAIL PROTECTED]> Tue, 06 Sep 2005 16:07:36 +1000

[PATCH] ppc64: Clean up CR handling

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 <[EMAIL PROTECTED]>
Signed-off-by: Anton Blanchard <[EMAIL PROTECTED]>
Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>

 arch/ppc64/kernel/udbg.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/arch/ppc64/kernel/udbg.c b/arch/ppc64/kernel/udbg.c
--- a/arch/ppc64/kernel/udbg.c
+++ b/arch/ppc64/kernel/udbg.c
@@ -169,12 +169,8 @@ void udbg_maple_real_putc(unsigned char 
                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 @@ void udbg_putc(unsigned char c)
                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) {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to