static int block_til_ready(struct tty_struct *tty, struct file * filp,                           struct specialix_port *port){	DECLARE_WAITQUEUE(wait,  current);	struct specialix_board *bp = port_Board(port);	int    retval;	int    do_clocal = 0;	int    CD;	unsigned long flags;	func_enter();	/*	 * If the device is in the middle of being closed, then block	 * until it's done, and then try again.	 */	if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) {		interruptible_sleep_on(&port->close_wait);		if (port->flags & ASYNC_HUP_NOTIFY) {			func_exit();			return -EAGAIN;		} else {			func_exit();			return -ERESTARTSYS;		}	}		/*	 * If non-blocking mode is set, or the port is not enabled,	 * then make the check up front and then exit.	 */	if ((filp->f_flags & O_NONBLOCK) ||	    (tty->flags & (1 << TTY_IO_ERROR))) {		port->flags |= ASYNC_NORMAL_ACTIVE;		func_exit();		return 0;	}	if (C_CLOCAL(tty))		do_clocal = 1;	/*	 * Block waiting for the carrier detect and the line to become	 * free (i.e., not in use by the callout).  While we are in	 * this loop, info->count is dropped by one, so that	 * rs_close() knows when to free things.  We restore it upon	 * exit, either normal or abnormal.	 */	retval = 0;	add_wait_queue(&port->open_wait, &wait);	spin_lock_irqsave(&port->lock, flags);	if (!tty_hung_up_p(filp)) {		port->count--;	}	spin_unlock_irqrestore(&port->lock, flags);	port->blocked_open++;	while (1) {		spin_lock_irqsave(&bp->lock, flags);		sx_out(bp, CD186x_CAR, port_No(port));		CD = sx_in(bp, CD186x_MSVR) & MSVR_CD;		if (SX_CRTSCTS (tty)) {			/* Activate RTS */			port->MSVR |= MSVR_DTR;		/* WTF? */			sx_out (bp, CD186x_MSVR, port->MSVR);		} else {			/* Activate DTR */			port->MSVR |= MSVR_DTR;			sx_out (bp, CD186x_MSVR, port->MSVR);		}		spin_unlock_irqrestore(&bp->lock, flags);		set_current_state(TASK_INTERRUPTIBLE);		if (tty_hung_up_p(filp) ||		    !(port->flags & ASYNC_INITIALIZED)) {			if (port->flags & ASYNC_HUP_NOTIFY)				retval = -EAGAIN;			else				retval = -ERESTARTSYS;				break;		}		if (!(port->flags & ASYNC_CLOSING) &&		    (do_clocal || CD))			break;		if (signal_pending(current)) {			retval = -ERESTARTSYS;			break;		}		schedule();	}	set_current_state(TASK_RUNNING);	remove_wait_queue(&port->open_wait, &wait);	spin_lock_irqsave(&port->lock, flags);	if (!tty_hung_up_p(filp)) {		port->count++;	}	port->blocked_open--;	spin_unlock_irqrestore(&port->lock, flags);	if (retval) {		func_exit();		return retval;	}	port->flags |= ASYNC_NORMAL_ACTIVE;	func_exit();	return 0;}	
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/d61780c0d384939ef31c46b47442854d5def4623/specialix.c/buggy/drivers/char/specialix.c