if (self->close_delay) { current->state = TASK_INTERRUPTIBLE; schedule_timeout(self->close_delay); } 
if (self->close_delay) schedule_timeout_interruptible(self->close_delay); 
static void ircomm_tty_close(struct tty_struct *tty, struct file *filp){	struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;	unsigned long flags;	IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );	if (!tty)		return;	IRDA_ASSERT(self != NULL, return;);	IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);	spin_lock_irqsave(&self->spinlock, flags);	if (tty_hung_up_p(filp)) {		spin_unlock_irqrestore(&self->spinlock, flags);		IRDA_DEBUG(0, "%s(), returning 1\n", __FUNCTION__ );		return;	}	if ((tty->count == 1) && (self->open_count != 1)) {		/*		 * Uh, oh.  tty->count is 1, which means that the tty		 * structure will be freed.  state->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.		 */		IRDA_DEBUG(0, "%s(), bad serial port count; "			   "tty->count is 1, state->count is %d\n", __FUNCTION__ , 			   self->open_count);		self->open_count = 1;	}	if (--self->open_count < 0) {		IRDA_ERROR("%s(), bad serial port count for ttys%d: %d\n",			   __FUNCTION__, self->line, self->open_count);		self->open_count = 0;	}	if (self->open_count) {		spin_unlock_irqrestore(&self->spinlock, flags);		IRDA_DEBUG(0, "%s(), open count > 0\n", __FUNCTION__ );		return;	}	/* Hum... Should be test_and_set_bit ??? - Jean II */	set_bit(ASYNC_B_CLOSING, &self->flags);	/* We need to unlock here (we were unlocking at the end of this	 * function), because tty_wait_until_sent() may schedule.	 * I don't know if the rest should be protected somehow,	 * so someone should check. - Jean II */	spin_unlock_irqrestore(&self->spinlock, flags);	/*	 * 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 (self->closing_wait != ASYNC_CLOSING_WAIT_NONE)		tty_wait_until_sent(tty, self->closing_wait);	ircomm_tty_shutdown(self);	if (tty->driver->flush_buffer)		tty->driver->flush_buffer(tty);	if (tty->ldisc.flush_buffer)		tty->ldisc.flush_buffer(tty);	tty->closing = 0;	self->tty = NULL;	if (self->blocked_open) {		if (self->close_delay) {			current->state = TASK_INTERRUPTIBLE;			schedule_timeout(self->close_delay);		}		wake_up_interruptible(&self->open_wait);	}	self->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);	wake_up_interruptible(&self->close_wait);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/121caf577dc61588c1128821873a08cec48baf58/ircomm_tty.c/clean/net/irda/ircomm/ircomm_tty.c