aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2011-08-25 09:12:05 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-25 12:00:39 -0400
commitbafb0bd24d7e0e0124318625b239a55d58c757a2 (patch)
treec5e262faa274ed54696cfb433717b99ddcee966c
parent426929f8d3514d7f727b8c464d1eeeaf74b21519 (diff)
TTY: serial, move locking in uart_close
So now, when we handle CLOSING flag, there is no point to hold port->mutex over the start of uart_close. Yes, there are still several things to reason about: * port->count etc is and always was protected by a spinlock * ->stop_rx is protected by a spinlock. Otherwise it would race with interrupts. * uart_wait_until_sent -- that one is already called without port->mutex from set_termios and tty_set_ldisc. Should anything be protected there, it would be tx_empty. And by a spinlock. 8250 does this internally... This step is needed to fix system stalls. To not create an AB-BA lock dependency (see next patches). Signed-off-by: Jiri Slaby <jslaby@suse.cz> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/tty/serial/serial_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 849bd0d06b2c..0464360781fe 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1253,7 +1253,6 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1253 1253
1254 pr_debug("uart_close(%d) called\n", uport->line); 1254 pr_debug("uart_close(%d) called\n", uport->line);
1255 1255
1256 mutex_lock(&port->mutex);
1257 spin_lock_irqsave(&port->lock, flags); 1256 spin_lock_irqsave(&port->lock, flags);
1258 1257
1259 if (tty_hung_up_p(filp)) { 1258 if (tty_hung_up_p(filp)) {
@@ -1312,6 +1311,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1312 uart_wait_until_sent(tty, uport->timeout); 1311 uart_wait_until_sent(tty, uport->timeout);
1313 } 1312 }
1314 1313
1314 mutex_lock(&port->mutex);
1315 uart_shutdown(tty, state); 1315 uart_shutdown(tty, state);
1316 uart_flush_buffer(tty); 1316 uart_flush_buffer(tty);
1317 1317