aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 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
226static 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
238static void n_tty_flush_buffer(struct tty_struct *tty) 250static 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/**