1039
1040
1041
1042
1043 port->IER &= ~IER_RXD;
1044 if (port->port.flags & ASYNC_INITIALIZED) {
1045 port->IER &= ~IER_TXRDY;
1046 port->IER |= IER_TXEMPTY;
1047 rc_out(bp, CD180_CAR, port_No(port));
1048 rc_out(bp, CD180_IER, port->IER);
1049
1050
1051
1052
1053
1054 timeout = jiffies + HZ;
1055 while (port->IER & IER_TXEMPTY) {
1056 msleep_interruptible(jiffies_to_msecs(port->timeout));
1057 if (time_after(jiffies, timeout))
1058 break;
1059 }
1060 }
1061 rc_shutdown_port(tty, bp, port);
1062 rc_flush_buffer(tty);
1063 tty_ldisc_flush(tty);
1064
1065 tty->closing = 0;
1066 port->port.tty = NULL;
1067 if (port->port.blocked_open) {
1068 if (port->port.close_delay)
1069 msleep_interruptible(jiffies_to_msecs(port->port.close_delay));
1070 wake_up_interruptible(&port->port.open_wait);
1071 }
1072 port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
1073 wake_up_interruptible(&port->port.close_wait);
1074
1075out:
1076 spin_unlock_irqrestore(&riscom_lock, flags);
1077}
1078
1079static int rc_write(struct tty_struct *tty,