aboutsummaryrefslogtreecommitdiff
path: root/drivers/tty/n_tty.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2013-03-11 16:44:22 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-18 16:32:46 -0700
commita30737ab7d99f27810b254787e5e62a6c92cb355 (patch)
tree4164294bf2b194f917d0524485f8aebb413ba8c5 /drivers/tty/n_tty.c
parent21622939fc452c7fb739464b8e49368c3ceaa0ee (diff)
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: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/n_tty.c')
-rw-r--r--drivers/tty/n_tty.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 16793eccc6a..7e7f6514fb5 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -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);
}
/**