aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_ioctl.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-14 18:23:32 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-14 18:23:32 -0500
commit37da7bbbe84fe9e8862940d3f9194fd27dce59bb (patch)
tree6c3fae910b4cfd4e2f9a1fdc035400cd4df78be3 /drivers/tty/tty_ioctl.c
parente7cf773d431a63a2417902696fcc9e0ebdc83bbe (diff)
parentdd63af108f0814f0b589659f4e55a7a5af3b7e53 (diff)
Merge tag 'tty-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial driver updates from Greg KH: "Here's the big tty/serial driver update for 3.19-rc1. There are a number of TTY core changes/fixes in here from Peter Hurley that have all been teted in linux-next for a long time now. There are also the normal serial driver updates as well, full details in the changelog below" * tag 'tty-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (219 commits) serial: pxa: hold port.lock when reporting modem line changes tty-hvsi_lib: Deletion of an unnecessary check before the function call "tty_kref_put" tty: Deletion of unnecessary checks before two function calls n_tty: Fix read_buf race condition, increment read_head after pushing data serial: of-serial: add PM suspend/resume support Revert "serial: of-serial: add PM suspend/resume support" Revert "serial: of-serial: fix up PM ops on no_console_suspend and port type" serial: 8250: don't attempt a trylock if in sysrq serial: core: Add big-endian iotype serial: samsung: use port->fifosize instead of hardcoded values serial: samsung: prefer to use fifosize from driver data serial: samsung: fix style problems serial: samsung: wait for transfer completion before clock disable serial: icom: fix error return code serial: tegra: clean up tty-flag assignments serial: Fix io address assign flow with Fintek PCI-to-UART Product serial: mxs-auart: fix tx_empty against shift register serial: mxs-auart: fix gpio change detection on interrupt serial: mxs-auart: Fix mxs_auart_set_ldisc() serial: 8250_dw: Use 64-bit access for OCTEON. ...
Diffstat (limited to 'drivers/tty/tty_ioctl.c')
-rw-r--r--drivers/tty/tty_ioctl.c38
1 files changed, 6 insertions, 32 deletions
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index 62380ccf70fb..1787fa4d9448 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -524,9 +524,8 @@ EXPORT_SYMBOL(tty_termios_hw_change);
524 * @tty: tty to update 524 * @tty: tty to update
525 * @new_termios: desired new value 525 * @new_termios: desired new value
526 * 526 *
527 * Perform updates to the termios values set on this terminal. There 527 * Perform updates to the termios values set on this terminal.
528 * is a bit of layering violation here with n_tty in terms of the 528 * A master pty's termios should never be set.
529 * internal knowledge of this function.
530 * 529 *
531 * Locking: termios_rwsem 530 * Locking: termios_rwsem
532 */ 531 */
@@ -535,8 +534,9 @@ int tty_set_termios(struct tty_struct *tty, struct ktermios *new_termios)
535{ 534{
536 struct ktermios old_termios; 535 struct ktermios old_termios;
537 struct tty_ldisc *ld; 536 struct tty_ldisc *ld;
538 unsigned long flags;
539 537
538 WARN_ON(tty->driver->type == TTY_DRIVER_TYPE_PTY &&
539 tty->driver->subtype == PTY_TYPE_MASTER);
540 /* 540 /*
541 * Perform the actual termios internal changes under lock. 541 * Perform the actual termios internal changes under lock.
542 */ 542 */
@@ -549,41 +549,15 @@ int tty_set_termios(struct tty_struct *tty, struct ktermios *new_termios)
549 tty->termios = *new_termios; 549 tty->termios = *new_termios;
550 unset_locked_termios(&tty->termios, &old_termios, &tty->termios_locked); 550 unset_locked_termios(&tty->termios, &old_termios, &tty->termios_locked);
551 551
552 /* See if packet mode change of state. */
553 if (tty->link && tty->link->packet) {
554 int extproc = (old_termios.c_lflag & EXTPROC) |
555 (tty->termios.c_lflag & EXTPROC);
556 int old_flow = ((old_termios.c_iflag & IXON) &&
557 (old_termios.c_cc[VSTOP] == '\023') &&
558 (old_termios.c_cc[VSTART] == '\021'));
559 int new_flow = (I_IXON(tty) &&
560 STOP_CHAR(tty) == '\023' &&
561 START_CHAR(tty) == '\021');
562 if ((old_flow != new_flow) || extproc) {
563 spin_lock_irqsave(&tty->ctrl_lock, flags);
564 if (old_flow != new_flow) {
565 tty->ctrl_status &= ~(TIOCPKT_DOSTOP | TIOCPKT_NOSTOP);
566 if (new_flow)
567 tty->ctrl_status |= TIOCPKT_DOSTOP;
568 else
569 tty->ctrl_status |= TIOCPKT_NOSTOP;
570 }
571 if (extproc)
572 tty->ctrl_status |= TIOCPKT_IOCTL;
573 spin_unlock_irqrestore(&tty->ctrl_lock, flags);
574 wake_up_interruptible(&tty->link->read_wait);
575 }
576 }
577
578 if (tty->ops->set_termios) 552 if (tty->ops->set_termios)
579 (*tty->ops->set_termios)(tty, &old_termios); 553 tty->ops->set_termios(tty, &old_termios);
580 else 554 else
581 tty_termios_copy_hw(&tty->termios, &old_termios); 555 tty_termios_copy_hw(&tty->termios, &old_termios);
582 556
583 ld = tty_ldisc_ref(tty); 557 ld = tty_ldisc_ref(tty);
584 if (ld != NULL) { 558 if (ld != NULL) {
585 if (ld->ops->set_termios) 559 if (ld->ops->set_termios)
586 (ld->ops->set_termios)(tty, &old_termios); 560 ld->ops->set_termios(tty, &old_termios);
587 tty_ldisc_deref(ld); 561 tty_ldisc_deref(ld);
588 } 562 }
589 up_write(&tty->termios_rwsem); 563 up_write(&tty->termios_rwsem);