diff options
Diffstat (limited to 'sys/dev/uart/uart_tty.c')
-rw-r--r-- | sys/dev/uart/uart_tty.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/dev/uart/uart_tty.c b/sys/dev/uart/uart_tty.c index 0c69fa25f6cf..736c756322a4 100644 --- a/sys/dev/uart/uart_tty.c +++ b/sys/dev/uart/uart_tty.c @@ -389,9 +389,19 @@ uart_tty_busy(struct tty *tp) sc = tty_softc(tp); if (sc == NULL || sc->sc_leaving) - return (FALSE); + return (false); - return (sc->sc_txbusy); + /* + * The tty locking is sufficient here; we may lose the race against + * uart_bus_ihand()/uart_intr() clearing sc_txbusy underneath us, in + * which case we will incorrectly but non-fatally report a busy Tx + * path upward. However, tty locking ensures that no additional output + * is enqueued before UART_TXBUSY() returns, which means that there + * are no Tx interrupts to be lost. + */ + if (sc->sc_txbusy) + return (true); + return (UART_TXBUSY(sc)); } static struct ttydevsw uart_tty_class = { |