set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(timeout); 
schedule_timeout_interruptible(timeout); 
static void pl2303_close (struct usb_serial_port *port, struct file *filp){	struct pl2303_private *priv = usb_get_serial_port_data(port);	unsigned long flags;	unsigned int c_cflag;	int bps;	long timeout;	wait_queue_t wait;						\	dbg("%s - port %d", __FUNCTION__, port->number);	/* wait for data to drain from the buffer */	spin_lock_irqsave(&priv->lock, flags);	timeout = PL2303_CLOSING_WAIT;	init_waitqueue_entry(&wait, current);	add_wait_queue(&port->tty->write_wait, &wait);	for (;;) {		set_current_state(TASK_INTERRUPTIBLE);		if (pl2303_buf_data_avail(priv->buf) == 0		|| timeout == 0 || signal_pending(current)		|| !usb_get_intfdata(port->serial->interface))	/* disconnect */			break;		spin_unlock_irqrestore(&priv->lock, flags);		timeout = schedule_timeout(timeout);		spin_lock_irqsave(&priv->lock, flags);	}	set_current_state(TASK_RUNNING);	remove_wait_queue(&port->tty->write_wait, &wait);	/* clear out any remaining data in the buffer */	pl2303_buf_clear(priv->buf);	spin_unlock_irqrestore(&priv->lock, flags);	/* wait for characters to drain from the device */	/* (this is long enough for the entire 256 byte */	/* pl2303 hardware buffer to drain with no flow */	/* control for data rates of 1200 bps or more, */	/* for lower rates we should really know how much */	/* data is in the buffer to compute a delay */	/* that is not unnecessarily long) */	bps = tty_get_baud_rate(port->tty);	if (bps > 1200)		timeout = max((HZ*2560)/bps,HZ/10);	else		timeout = 2*HZ;	set_current_state(TASK_INTERRUPTIBLE);	schedule_timeout(timeout);	/* shutdown our urbs */	dbg("%s - shutting down urbs", __FUNCTION__);	usb_kill_urb(port->write_urb);	usb_kill_urb(port->read_urb);	usb_kill_urb(port->interrupt_in_urb);	if (port->tty) {		c_cflag = port->tty->termios->c_cflag;		if (c_cflag & HUPCL) {			/* drop DTR and RTS */			spin_lock_irqsave(&priv->lock, flags);			priv->line_control = 0;			spin_unlock_irqrestore (&priv->lock, flags);			set_control_lines (port->serial->dev, 0);		}	}}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/22c438632850c0d6257b45c90afed0cea6953afc/pl2303.c/clean/drivers/usb/serial/pl2303.c