/** * n_hdlc_tty_close - line discipline close * @tty - pointer to tty info structure * * Called when the line discipline is changed to something * else, the tty is closed, or the tty detects a hangup. */ static void n_hdlc_tty_close(struct tty_struct *tty) { struct n_hdlc *n_hdlc = tty2n_hdlc (tty); if (debuglevel >= DEBUG_LEVEL_INFO) printk("%s(%d)n_hdlc_tty_close() called\n",__FILE__,__LINE__); if (n_hdlc != NULL) { if (n_hdlc->magic != HDLC_MAGIC) { printk (KERN_WARNING"n_hdlc: trying to close unopened tty!\n"); return; } #if defined(TTY_NO_WRITE_SPLIT) clear_bit(TTY_NO_WRITE_SPLIT,&tty->flags); #endif tty->disc_data = NULL; if (tty == n_hdlc->backup_tty) n_hdlc->backup_tty = NULL; if (tty != n_hdlc->tty) return; if (n_hdlc->backup_tty) { n_hdlc->tty = n_hdlc->backup_tty; } else { n_hdlc_release (n_hdlc); } } if (debuglevel >= DEBUG_LEVEL_INFO) printk("%s(%d)n_hdlc_tty_close() success\n",__FILE__,__LINE__); } /* end of n_hdlc_tty_close() */
static void vl_sync_release_port(struct vl_sync_port *port) { unsigned long flags; pr_debug("VL_SYNC[%d]:release\n", port->line); /* Ensure that the process is not hanging on select()/poll() */ wake_up_interruptible (&port->read_wait); wake_up_interruptible (&port->write_wait); // if (port->wait_closing) // vl_sync_wait_until_send(port); n_hdlc_release(port->n_hdlc); port->n_hdlc = NULL; /* clear open flag */ spin_lock_irqsave(&port->ctrl_lock, flags); port->flags &= ~FLAG_OPEN; spin_unlock_irqrestore(&port->ctrl_lock, flags); return; }