/* Purpose: Let user call ioctl() to get info when the UART physically is emptied. On bus types like RS485, the transmitter must release the bus after transmitting. This must be done when the transmit shift register is empty, not be done when the transmit holding register is empty. This functionality allows an RS485 driver to be written in user space.  */
static unsigned int zs_tx_empty(struct uart_port *uport)
/* Purpose: Let user call ioctl() to get info when the UART physically is emptied. On bus types like RS485, the transmitter must release the bus after transmitting. This must be done when the transmit shift register is empty, not be done when the transmit holding register is empty. This functionality allows an RS485 driver to be written in user space.  */
static unsigned int zs_tx_empty(struct uart_port *uport)
{
	struct zs_port *zport = to_zport(uport);
	struct zs_scc *scc = zport->scc;
	unsigned long flags;
	u8 status;
	spin_lock_irqsave(&scc->zlock, flags);
	status = read_zsreg(zport, R1);
	spin_unlock_irqrestore(&scc->zlock, flags);
	return status & ALL_SNT ? TIOCSER_TEMT : 0;
}