|
| 1 | +From cc88cf0846636a553eb132604da8dcc318593118 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Chris Co < [email protected]> |
| 3 | +Date: Sun, 9 Mar 2025 23:37:53 -0700 |
| 4 | +Subject: [PATCH] Revert "serial: 8250: Adjust the timeout for FIFO mode" |
| 5 | + |
| 6 | +This reverts commit fe616b82bc46982f60c2f95fe0f3023d7de6598b. |
| 7 | +--- |
| 8 | + drivers/tty/serial/8250/8250_port.c | 32 ++++++----------------------- |
| 9 | + 1 file changed, 6 insertions(+), 26 deletions(-) |
| 10 | + |
| 11 | +diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c |
| 12 | +index 2b1b2928ef7b..a17803da83f8 100644 |
| 13 | +--- a/drivers/tty/serial/8250/8250_port.c |
| 14 | ++++ b/drivers/tty/serial/8250/8250_port.c |
| 15 | +@@ -2074,8 +2074,7 @@ static void serial8250_break_ctl(struct uart_port *port, int break_state) |
| 16 | + serial8250_rpm_put(up); |
| 17 | + } |
| 18 | + |
| 19 | +-/* Returns true if @bits were set, false on timeout */ |
| 20 | +-static bool wait_for_lsr(struct uart_8250_port *up, int bits) |
| 21 | ++static void wait_for_lsr(struct uart_8250_port *up, int bits) |
| 22 | + { |
| 23 | + unsigned int status, tmout = 10000; |
| 24 | + |
| 25 | +@@ -2090,11 +2089,11 @@ static bool wait_for_lsr(struct uart_8250_port *up, int bits) |
| 26 | + udelay(1); |
| 27 | + touch_nmi_watchdog(); |
| 28 | + } |
| 29 | +- |
| 30 | +- return (tmout != 0); |
| 31 | + } |
| 32 | + |
| 33 | +-/* Wait for transmitter and holding register to empty with timeout */ |
| 34 | ++/* |
| 35 | ++ * Wait for transmitter & holding register to empty |
| 36 | ++ */ |
| 37 | + static void wait_for_xmitr(struct uart_8250_port *up, int bits) |
| 38 | + { |
| 39 | + unsigned int tmout; |
| 40 | +@@ -3351,16 +3350,6 @@ static void serial8250_console_restore(struct uart_8250_port *up) |
| 41 | + serial8250_out_MCR(up, up->mcr | UART_MCR_DTR | UART_MCR_RTS); |
| 42 | + } |
| 43 | + |
| 44 | +-static void fifo_wait_for_lsr(struct uart_8250_port *up, unsigned int count) |
| 45 | +-{ |
| 46 | +- unsigned int i; |
| 47 | +- |
| 48 | +- for (i = 0; i < count; i++) { |
| 49 | +- if (wait_for_lsr(up, UART_LSR_THRE)) |
| 50 | +- return; |
| 51 | +- } |
| 52 | +-} |
| 53 | +- |
| 54 | + /* |
| 55 | + * Print a string to the serial port using the device FIFO |
| 56 | + * |
| 57 | +@@ -3370,15 +3359,13 @@ static void fifo_wait_for_lsr(struct uart_8250_port *up, unsigned int count) |
| 58 | + static void serial8250_console_fifo_write(struct uart_8250_port *up, |
| 59 | + const char *s, unsigned int count) |
| 60 | + { |
| 61 | ++ int i; |
| 62 | + const char *end = s + count; |
| 63 | + unsigned int fifosize = up->tx_loadsz; |
| 64 | +- unsigned int tx_count = 0; |
| 65 | + bool cr_sent = false; |
| 66 | +- unsigned int i; |
| 67 | + |
| 68 | + while (s != end) { |
| 69 | +- /* Allow timeout for each byte of a possibly full FIFO */ |
| 70 | +- fifo_wait_for_lsr(up, fifosize); |
| 71 | ++ wait_for_lsr(up, UART_LSR_THRE); |
| 72 | + |
| 73 | + for (i = 0; i < fifosize && s != end; ++i) { |
| 74 | + if (*s == '\n' && !cr_sent) { |
| 75 | +@@ -3389,14 +3376,7 @@ static void serial8250_console_fifo_write(struct uart_8250_port *up, |
| 76 | + cr_sent = false; |
| 77 | + } |
| 78 | + } |
| 79 | +- tx_count = i; |
| 80 | + } |
| 81 | +- |
| 82 | +- /* |
| 83 | +- * Allow timeout for each byte written since the caller will only wait |
| 84 | +- * for UART_LSR_BOTH_EMPTY using the timeout of a single character |
| 85 | +- */ |
| 86 | +- fifo_wait_for_lsr(up, tx_count); |
| 87 | + } |
| 88 | + |
| 89 | + /* |
| 90 | +-- |
| 91 | +2.45.2 |
| 92 | + |
0 commit comments