Skip to content

Commit de88063

Browse files
Nicolas PitreRussell King
authored andcommitted
ARM: 8705/1: early_printk: use printascii() rather than printch()
With printch() the console messages are sent out one character at a time which is agonizingly slow especially with semihosting as the whole trap intercept, remote byte access, and system resume danse is performed for every single character across a relatively slow remote debug connection. Let's use printascii() to send a whole string at once. This is also going to be more efficient, albeit to a quite lesser extent, with serial ports as well. Signed-off-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
1 parent e11d131 commit de88063

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎arch/arm/kernel/early_printk.c‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,20 @@
1111
#include <linux/kernel.h>
1212
#include <linux/console.h>
1313
#include <linux/init.h>
14+
#include <linux/string.h>
1415

15-
extern void printch(int);
16+
extern void printascii(const char *);
1617

1718
static void early_write(const char *s, unsigned n)
1819
{
19-
while (n-- > 0) {
20-
if (*s == '\n')
21-
printch('\r');
22-
printch(*s);
23-
s++;
20+
char buf[128];
21+
while (n) {
22+
unsigned l = min(n, sizeof(buf)-1);
23+
memcpy(buf, s, l);
24+
buf[l] = 0;
25+
s += l;
26+
n -= l;
27+
printascii(buf);
2428
}
2529
}
2630

0 commit comments

Comments
 (0)