Exemplo n.º 1
0
static void qt_block_until_empty(struct tty_struct *tty,
				 struct quatech_port *qt_port)
{
	int timeout = HZ / 10;
	int wait = 30;
	int count;

	while (1) {

		count = qt_chars_in_buffer(tty);

		if (count <= 0)
			return;

		interruptible_sleep_on_timeout(&qt_port->wait, timeout);

		wait--;
		if (wait == 0) {
			dev_dbg(&qt_port->port->dev, "%s - TIMEOUT", __func__);
			return;
		} else {
			wait = 30;
		}
	}
}
Exemplo n.º 2
0
static void qt_block_until_empty(struct tty_struct *tty,
				 struct quatech_port *qt_port)
{
	int timeout = HZ / 10;
	int wait = 30;

	/* returns if we get a signal, an error, or the buffer is empty */
	while (wait_event_interruptible_timeout(qt_port->wait,
					qt_chars_in_buffer(tty) <= 0,
					timeout) == 0) {
		wait--;
		if (wait == 0) {
			dev_dbg(&qt_port->port->dev, "%s - TIMEOUT", __func__);
			return;
		} else {
			wait = 30;
		}
	}
}