Commit 2fc20661e3171d45e8e58a61eb5c6b7d8d614fde

Authored by Jiri Slaby
Committed by Greg Kroah-Hartman
1 parent 57c941212d

TTY: move TTY_FLUSH* flags to tty_port

They are only TTY buffers specific. And the buffers will go to
tty_port in the next patches. So to remove the need to have both
tty_port and tty_struct at some places, let us move the flags to
tty_port.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 2 changed files with 13 additions and 10 deletions Side-by-side Diff

drivers/tty/tty_buffer.c
... ... @@ -134,17 +134,18 @@
134 134  
135 135 void tty_buffer_flush(struct tty_struct *tty)
136 136 {
  137 + struct tty_port *port = tty->port;
137 138 unsigned long flags;
138 139 spin_lock_irqsave(&tty->buf.lock, flags);
139 140  
140 141 /* If the data is being pushed to the tty layer then we can't
141 142 process it here. Instead set a flag and the flush_to_ldisc
142 143 path will process the flush request before it exits */
143   - if (test_bit(TTY_FLUSHING, &tty->flags)) {
144   - set_bit(TTY_FLUSHPENDING, &tty->flags);
  144 + if (test_bit(TTYP_FLUSHING, &port->iflags)) {
  145 + set_bit(TTYP_FLUSHPENDING, &port->iflags);
145 146 spin_unlock_irqrestore(&tty->buf.lock, flags);
146 147 wait_event(tty->read_wait,
147   - test_bit(TTY_FLUSHPENDING, &tty->flags) == 0);
  148 + test_bit(TTYP_FLUSHPENDING, &port->iflags) == 0);
148 149 return;
149 150 } else
150 151 __tty_buffer_flush(tty);
... ... @@ -450,6 +451,7 @@
450 451 {
451 452 struct tty_struct *tty =
452 453 container_of(work, struct tty_struct, buf.work);
  454 + struct tty_port *port = tty->port;
453 455 unsigned long flags;
454 456 struct tty_ldisc *disc;
455 457  
... ... @@ -459,7 +461,7 @@
459 461  
460 462 spin_lock_irqsave(&tty->buf.lock, flags);
461 463  
462   - if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) {
  464 + if (!test_and_set_bit(TTYP_FLUSHING, &port->iflags)) {
463 465 struct tty_buffer *head;
464 466 while ((head = tty->buf.head) != NULL) {
465 467 int count;
... ... @@ -477,7 +479,7 @@
477 479 /* Ldisc or user is trying to flush the buffers
478 480 we are feeding to the ldisc, stop feeding the
479 481 line discipline as we want to empty the queue */
480   - if (test_bit(TTY_FLUSHPENDING, &tty->flags))
  482 + if (test_bit(TTYP_FLUSHPENDING, &port->iflags))
481 483 break;
482 484 if (!tty->receive_room)
483 485 break;
484 486  
485 487  
... ... @@ -491,14 +493,14 @@
491 493 flag_buf, count);
492 494 spin_lock_irqsave(&tty->buf.lock, flags);
493 495 }
494   - clear_bit(TTY_FLUSHING, &tty->flags);
  496 + clear_bit(TTYP_FLUSHING, &port->iflags);
495 497 }
496 498  
497 499 /* We may have a deferred request to flush the input buffer,
498 500 if so pull the chain under the lock and empty the queue */
499   - if (test_bit(TTY_FLUSHPENDING, &tty->flags)) {
  501 + if (test_bit(TTYP_FLUSHPENDING, &port->iflags)) {
500 502 __tty_buffer_flush(tty);
501   - clear_bit(TTY_FLUSHPENDING, &tty->flags);
  503 + clear_bit(TTYP_FLUSHPENDING, &port->iflags);
502 504 wake_up(&tty->read_wait);
503 505 }
504 506 spin_unlock_irqrestore(&tty->buf.lock, flags);
... ... @@ -197,6 +197,9 @@
197 197 wait_queue_head_t close_wait; /* Close waiters */
198 198 wait_queue_head_t delta_msr_wait; /* Modem status change */
199 199 unsigned long flags; /* TTY flags ASY_*/
  200 + unsigned long iflags; /* TTYP_ internal flags */
  201 +#define TTYP_FLUSHING 1 /* Flushing to ldisc in progress */
  202 +#define TTYP_FLUSHPENDING 2 /* Queued buffer flush pending */
200 203 unsigned char console:1; /* port is a console */
201 204 struct mutex mutex; /* Locking */
202 205 struct mutex buf_mutex; /* Buffer alloc lock */
... ... @@ -309,8 +312,6 @@
309 312 #define TTY_PTY_LOCK 16 /* pty private */
310 313 #define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
311 314 #define TTY_HUPPED 18 /* Post driver->hangup() */
312   -#define TTY_FLUSHING 19 /* Flushing to ldisc in progress */
313   -#define TTY_FLUSHPENDING 20 /* Queued buffer flush pending */
314 315 #define TTY_HUPPING 21 /* ->hangup() in progress */
315 316  
316 317 #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))