提交 a30737ab 编写于 作者: P Peter Hurley 提交者: Greg Kroah-Hartman

n_tty: Factor packet mode status change for reuse

Factor the packet mode status change from n_tty_flush_buffer
for use by follow-on patch.
Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 21622939
......@@ -223,6 +223,18 @@ static void reset_buffer_flags(struct tty_struct *tty)
n_tty_set_room(tty);
}
static void n_tty_packet_mode_flush(struct tty_struct *tty)
{
unsigned long flags;
spin_lock_irqsave(&tty->ctrl_lock, flags);
if (tty->link->packet) {
tty->ctrl_status |= TIOCPKT_FLUSHREAD;
wake_up_interruptible(&tty->link->read_wait);
}
spin_unlock_irqrestore(&tty->ctrl_lock, flags);
}
/**
* n_tty_flush_buffer - clean input queue
* @tty: terminal device
......@@ -237,19 +249,11 @@ static void reset_buffer_flags(struct tty_struct *tty)
static void n_tty_flush_buffer(struct tty_struct *tty)
{
unsigned long flags;
/* clear everything and unthrottle the driver */
reset_buffer_flags(tty);
if (!tty->link)
return;
spin_lock_irqsave(&tty->ctrl_lock, flags);
if (tty->link->packet) {
tty->ctrl_status |= TIOCPKT_FLUSHREAD;
wake_up_interruptible(&tty->link->read_wait);
}
spin_unlock_irqrestore(&tty->ctrl_lock, flags);
if (tty->link)
n_tty_packet_mode_flush(tty);
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册