/* Perform port level tty hangup flag and count changes. Drop the tty reference.  */
void tty_port_hangup(struct tty_port *port)
/* Perform port level tty hangup flag and count changes. Drop the tty reference.  */
void tty_port_hangup(struct tty_port *port)
{
	unsigned long flags;
	spin_lock_irqsave(&port->lock, flags);
	port->count = 0;
	port->flags &= ~ASYNC_NORMAL_ACTIVE;
	if (port->tty) {
		set_bit(TTY_IO_ERROR, &port->tty->flags);
		tty_kref_put(port->tty);
	}
	port->tty = NULL;
	spin_unlock_irqrestore(&port->lock, flags);
	wake_up_interruptible(&port->open_wait);
	wake_up_interruptible(&port->delta_msr_wait);
	tty_port_shutdown(port);
}