diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2013-03-11 16:44:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-18 19:32:46 -0400 |
commit | a30737ab7d99f27810b254787e5e62a6c92cb355 (patch) | |
tree | 4164294bf2b194f917d0524485f8aebb413ba8c5 /drivers/tty/n_tty.c | |
parent | 21622939fc452c7fb739464b8e49368c3ceaa0ee (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.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 16793eccc6ae..7e7f6514fb53 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) | |||
223 | n_tty_set_room(tty); | 223 | n_tty_set_room(tty); |
224 | } | 224 | } |
225 | 225 | ||
226 | static void n_tty_packet_mode_flush(struct tty_struct *tty) | ||
227 | { | ||
228 | unsigned long flags; | ||
229 | |||
230 | spin_lock_irqsave(&tty->ctrl_lock, flags); | ||
231 | if (tty->link->packet) { | ||
232 | tty->ctrl_status |= TIOCPKT_FLUSHREAD; | ||
233 | wake_up_interruptible(&tty->link->read_wait); | ||
234 | } | ||
235 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); | ||
236 | } | ||
237 | |||
226 | /** | 238 | /** |
227 | * n_tty_flush_buffer - clean input queue | 239 | * n_tty_flush_buffer - clean input queue |
228 | * @tty: terminal device | 240 | * @tty: terminal device |
@@ -237,19 +249,11 @@ static void reset_buffer_flags(struct tty_struct *tty) | |||
237 | 249 | ||
238 | static void n_tty_flush_buffer(struct tty_struct *tty) | 250 | static void n_tty_flush_buffer(struct tty_struct *tty) |
239 | { | 251 | { |
240 | unsigned long flags; | ||
241 | /* clear everything and unthrottle the driver */ | 252 | /* clear everything and unthrottle the driver */ |
242 | reset_buffer_flags(tty); | 253 | reset_buffer_flags(tty); |
243 | 254 | ||
244 | if (!tty->link) | 255 | if (tty->link) |
245 | return; | 256 | n_tty_packet_mode_flush(tty); |
246 | |||
247 | spin_lock_irqsave(&tty->ctrl_lock, flags); | ||
248 | if (tty->link->packet) { | ||
249 | tty->ctrl_status |= TIOCPKT_FLUSHREAD; | ||
250 | wake_up_interruptible(&tty->link->read_wait); | ||
251 | } | ||
252 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); | ||
253 | } | 257 | } |
254 | 258 | ||
255 | /** | 259 | /** |