The current code waits until the transmitter becomes empty, before sending each character, and after finishing the whole string. This seems a bit redundant. It can be more efficient by checking the transmitter only after sending each character. This should be safe because the transmitter is already empty at the first entry of serial_putc().
Unified · Split
| @@ -87,8 +87,8 @@ static void __init wait_for_xmitr(struct uart_port *port) · 86 unmodified lines | |||
| 87 | 87 | ||
| 88 | static void __init serial_putc(struct uart_port *port, int c) | 88 | static void __init serial_putc(struct uart_port *port, int c) |
| 89 | { | 89 | { |
| 90 | wait_for_xmitr(port); | ||
| 91 | serial8250_early_out(port, UART_TX, c); | 90 | serial8250_early_out(port, UART_TX, c); |
| 91 | wait_for_xmitr(port); | ||
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | static void __init early_serial8250_write(struct console *console, | 94 | static void __init early_serial8250_write(struct console *console, |
| @@ -98,9 +98,6 @@ static void __init early_serial8250_write(struct console *console, · 3 unmodified lines | |||
| 98 | struct uart_port *port = &device->port; | 98 | struct uart_port *port = &device->port; |
| 99 | 99 | ||
| 100 | uart_console_write(port, s, count, serial_putc); | 100 | uart_console_write(port, s, count, serial_putc); |
| 101 | |||
| 102 | /* Wait for transmitter to become empty */ | ||
| 103 | wait_for_xmitr(port); | ||
| 104 | } | 101 | } |
| 105 | 102 | ||
| 106 | static void __init init_port(struct earlycon_device *device) | 103 | static void __init init_port(struct earlycon_device *device) |