@@ -414,6 +414,9 @@ uart_update_timeout(struct uart_port *port, unsigned int cflag,
temp *= NSEC_PER_SEC;
port->frame_time = (unsigned int)DIV64_U64_ROUND_UP(temp, baud);
+
+ if (port->fifosize > 1)
+ port->timeout = uart_fifo_timeout(port);
}
EXPORT_SYMBOL(uart_update_timeout);
@@ -561,6 +561,7 @@ struct uart_port {
bool hw_stopped; /* sw-assisted CTS flow state */
unsigned int mctrl; /* current modem ctrl settings */
+ unsigned long timeout; /* character-based timeout */
unsigned int frame_time; /* frame timing in ns */
unsigned int type; /* port type */
const struct uart_ops *ops;
This is a partial revert of Commit f9008285bb69 ("serial: Drop timeout from uart_port"). In order to prevent having to calculate a timeout for the fifo device during a write operation, if enabled, calculate it ahead of time and store the value of the timeout in a struct member of uart_port. Signed-off-by: Michael Pratt <mcpratt@pm.me> --- V1 -> V2: new commit drivers/tty/serial/serial_core.c | 3 +++ include/linux/serial_core.h | 1 + 2 files changed, 4 insertions(+)