summaryrefslogtreecommitdiff
path: root/drivers/tty/amiserial.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-03-05 17:52:48 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-09 00:50:02 +0400
commitb8edebe4b8b4ad5bd436cf9080b77b29e219029a (patch)
tree41cbe2cf6027f051a234fe42f6a97cc6ddadf446 /drivers/tty/amiserial.c
parent6e1aeb0379f47b51ad4d25e5e0d9648dbd50f0b9 (diff)
downloadlinux-b8edebe4b8b4ad5bd436cf9080b77b29e219029a.tar.xz
TTY: amiserial, use tty_port_close_end
Hmm, the code was sleeping with interrupts disabled. This was not good. Fix this by turning interrupts at an appropriate place. (The race is protected by CLOSING flag.) After the move, the code is identical to tty_port_close_end, so use it! Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/amiserial.c')
-rw-r--r--drivers/tty/amiserial.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 8cc8e15c74d0..9c8b199bad35 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -1433,6 +1433,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
* the line discipline to only process XON/XOFF characters.
*/
tty->closing = 1;
+ local_irq_restore(flags);
if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
tty_wait_until_sent(tty, port->closing_wait);
/*
@@ -1461,17 +1462,9 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
rs_flush_buffer(tty);
tty_ldisc_flush(tty);
- tty->closing = 0;
port->tty = NULL;
- if (port->blocked_open) {
- if (port->close_delay) {
- msleep_interruptible(jiffies_to_msecs(port->close_delay));
- }
- wake_up_interruptible(&port->open_wait);
- }
- port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
- wake_up_interruptible(&port->close_wait);
- local_irq_restore(flags);
+
+ tty_port_close_end(port, tty);
}
/*