aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_port.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_port.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_port.c')
-rw-r--r--drivers/tty/tty_port.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 1b9335796da4..40b31835f80b 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -193,8 +193,7 @@ void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty)
193 unsigned long flags; 193 unsigned long flags;
194 194
195 spin_lock_irqsave(&port->lock, flags); 195 spin_lock_irqsave(&port->lock, flags);
196 if (port->tty) 196 tty_kref_put(port->tty);
197 tty_kref_put(port->tty);
198 port->tty = tty_kref_get(tty); 197 port->tty = tty_kref_get(tty);
199 spin_unlock_irqrestore(&port->lock, flags); 198 spin_unlock_irqrestore(&port->lock, flags);
200} 199}
@@ -473,12 +472,10 @@ int tty_port_close_start(struct tty_port *port,
473{ 472{
474 unsigned long flags; 473 unsigned long flags;
475 474
476 spin_lock_irqsave(&port->lock, flags); 475 if (tty_hung_up_p(filp))
477 if (tty_hung_up_p(filp)) {
478 spin_unlock_irqrestore(&port->lock, flags);
479 return 0; 476 return 0;
480 }
481 477
478 spin_lock_irqsave(&port->lock, flags);
482 if (tty->count == 1 && port->count != 1) { 479 if (tty->count == 1 && port->count != 1) {
483 printk(KERN_WARNING 480 printk(KERN_WARNING
484 "tty_port_close_start: tty->count = 1 port count = %d.\n", 481 "tty_port_close_start: tty->count = 1 port count = %d.\n",
@@ -522,6 +519,7 @@ void tty_port_close_end(struct tty_port *port, struct tty_struct *tty)
522{ 519{
523 unsigned long flags; 520 unsigned long flags;
524 521
522 tty_ldisc_flush(tty);
525 tty->closing = 0; 523 tty->closing = 0;
526 524
527 spin_lock_irqsave(&port->lock, flags); 525 spin_lock_irqsave(&port->lock, flags);