if (info->close_delay) { set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(info->close_delay); } 
if (info->close_delay) schedule_timeout_interruptible(info->close_delay); 
static void mxser_close(struct tty_struct *tty, struct file *filp){	struct mxser_struct *info = (struct mxser_struct *) tty->driver_data;	unsigned long timeout;	unsigned long flags;	struct tty_ldisc *ld;	if (tty->index == MXSER_PORTS)		return;	if (!info)		BUG();	spin_lock_irqsave(&info->slock, flags);	if (tty_hung_up_p(filp)) {		spin_unlock_irqrestore(&info->slock, flags);		return;	}	if ((tty->count == 1) && (info->count != 1)) {		/*		 * Uh, oh.  tty->count is 1, which means that the tty		 * structure will be freed.  Info->count should always		 * be one in these conditions.  If it's greater than		 * one, we've got real problems, since it means the		 * serial port won't be shutdown.		 */		printk(KERN_ERR "mxser_close: bad serial port count; tty->count is 1, " "info->count is %d\n", info->count);		info->count = 1;	}	if (--info->count < 0) {		printk(KERN_ERR "mxser_close: bad serial port count for ttys%d: %d\n", info->port, info->count);		info->count = 0;	}	if (info->count) {		spin_unlock_irqrestore(&info->slock, flags);		return;	}	info->flags |= ASYNC_CLOSING;	spin_unlock_irqrestore(&info->slock, flags);	/*	 * Save the termios structure, since this port may have	 * separate termios for callout and dialin.	 */	if (info->flags & ASYNC_NORMAL_ACTIVE)		info->normal_termios = *tty->termios;	/*	 * Now we wait for the transmit buffer to clear; and we notify	 * the line discipline to only process XON/XOFF characters.	 */	tty->closing = 1;	if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE)		tty_wait_until_sent(tty, info->closing_wait);	/*	 * At this point we stop accepting input.  To do this, we	 * disable the receive line status interrupts, and tell the	 * interrupt driver to stop checking the data ready bit in the	 * line status register.	 */	info->IER &= ~UART_IER_RLSI;	if (info->IsMoxaMustChipFlag)		info->IER &= ~MOXA_MUST_RECV_ISR;/* by William	info->read_status_mask &= ~UART_LSR_DR;*/	if (info->flags & ASYNC_INITIALIZED) {		outb(info->IER, info->base + UART_IER);		/*		 * Before we drop DTR, make sure the UART transmitter		 * has completely drained; this is especially		 * important if there is a transmit FIFO!		 */		timeout = jiffies + HZ;		while (!(inb(info->base + UART_LSR) & UART_LSR_TEMT)) {			set_current_state(TASK_INTERRUPTIBLE);			schedule_timeout(5);			if (time_after(jiffies, timeout))				break;		}	}	mxser_shutdown(info);	if (tty->driver->flush_buffer)		tty->driver->flush_buffer(tty);			ld = tty_ldisc_ref(tty);	if (ld) {		if(ld->flush_buffer)			ld->flush_buffer(tty);		tty_ldisc_deref(ld);	}			tty->closing = 0;	info->event = 0;	info->tty = NULL;	if (info->blocked_open) {		if (info->close_delay) {			set_current_state(TASK_INTERRUPTIBLE);			schedule_timeout(info->close_delay);		}		wake_up_interruptible(&info->open_wait);	}	info->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING);	wake_up_interruptible(&info->close_wait);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/da4cd8dfe18ee901b880f94ca0fa79d5cc1cd0eb/mxser.c/clean/drivers/char/mxser.c