The lvl variable read from the SC16IS7XX_TXLVL_REG register was treated as the number of elements in the fifo where the driver in reality return the number of free places in the fifo. This patch transforms the mnumber of free places to the number of elements in the fifo. This was tested observing the behavior in the i2c realm on a logic analyzer with and without the fix during the closing stage of the driver with and without data in the transmit fifo. Signed-off-by: Michel Vos <mhlvos@xxxxxxxxx> --- diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index df9a384..1323207 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -699,7 +699,8 @@ static unsigned int sc16is7xx_tx_empty(struct uart_port *port) { unsigned int lvl, lsr; - lvl = sc16is7xx_port_read(port, SC16IS7XX_TXLVL_REG); + lvl = sc16is7xx_port_read(port, SC16IS7XX_TXLVL_REG) - + SC16IS7XX_FIFO_SIZE; lsr = sc16is7xx_port_read(port, SC16IS7XX_LSR_REG); return ((lsr & SC16IS7XX_LSR_THRE_BIT) && !lvl) ? TIOCSER_TEMT : 0; -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html