aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2011-07-14 08:35:14 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-23 13:34:07 -0400
commit906cbe1364d94da7cbf74c1d05e3e78b2883f661 (patch)
treefca513a03781a2d0e2ac518aab13c8d528a0468c /drivers/tty
parenteff4b0b9fe37873d3dc7ade0e08e6f0f89279b8b (diff)
TTY: remove tty_locked
We used it really only serial and ami_serial. The rest of the callsites were BUG/WARN_ONs to check if BTM is held. Now that we pruned tty_locked from both of the real users, we can get rid of tty_lock along with __big_tty_mutex_owner. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Acked-by: Arnd Bergmann <arnd@arndb.de> Cc: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/serial_core.c4
-rw-r--r--drivers/tty/tty_ldisc.c1
-rw-r--r--drivers/tty/tty_mutex.c12
-rw-r--r--drivers/tty/vt/selection.c4
4 files changed, 2 insertions, 19 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 4786232bc532..44c29631b724 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1245,8 +1245,6 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1245 struct uart_port *uport; 1245 struct uart_port *uport;
1246 unsigned long flags; 1246 unsigned long flags;
1247 1247
1248 BUG_ON(!tty_locked());
1249
1250 if (!state) 1248 if (!state)
1251 return; 1249 return;
1252 1250
@@ -1411,7 +1409,6 @@ static void uart_hangup(struct tty_struct *tty)
1411 struct tty_port *port = &state->port; 1409 struct tty_port *port = &state->port;
1412 unsigned long flags; 1410 unsigned long flags;
1413 1411
1414 BUG_ON(!tty_locked());
1415 pr_debug("uart_hangup(%d)\n", state->uart_port->line); 1412 pr_debug("uart_hangup(%d)\n", state->uart_port->line);
1416 1413
1417 mutex_lock(&port->mutex); 1414 mutex_lock(&port->mutex);
@@ -1498,7 +1495,6 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
1498 struct tty_port *port; 1495 struct tty_port *port;
1499 int retval, line = tty->index; 1496 int retval, line = tty->index;
1500 1497
1501 BUG_ON(!tty_locked());
1502 pr_debug("uart_open(%d) called\n", line); 1498 pr_debug("uart_open(%d) called\n", line);
1503 1499
1504 /* 1500 /*
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index ef925d581713..512c49f98e85 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -450,7 +450,6 @@ static int tty_ldisc_open(struct tty_struct *tty, struct tty_ldisc *ld)
450 if (ld->ops->open) { 450 if (ld->ops->open) {
451 int ret; 451 int ret;
452 /* BTM here locks versus a hangup event */ 452 /* BTM here locks versus a hangup event */
453 WARN_ON(!tty_locked());
454 ret = ld->ops->open(tty); 453 ret = ld->ops->open(tty);
455 if (ret) 454 if (ret)
456 clear_bit(TTY_LDISC_OPEN, &tty->flags); 455 clear_bit(TTY_LDISC_OPEN, &tty->flags);
diff --git a/drivers/tty/tty_mutex.c b/drivers/tty/tty_mutex.c
index 3b2bb7719442..9ff986c32a21 100644
--- a/drivers/tty/tty_mutex.c
+++ b/drivers/tty/tty_mutex.c
@@ -15,30 +15,18 @@
15 * Don't use in new code. 15 * Don't use in new code.
16 */ 16 */
17static DEFINE_MUTEX(big_tty_mutex); 17static DEFINE_MUTEX(big_tty_mutex);
18struct task_struct *__big_tty_mutex_owner;
19EXPORT_SYMBOL_GPL(__big_tty_mutex_owner);
20 18
21/* 19/*
22 * Getting the big tty mutex. 20 * Getting the big tty mutex.
23 */ 21 */
24void __lockfunc tty_lock(void) 22void __lockfunc tty_lock(void)
25{ 23{
26 struct task_struct *task = current;
27
28 WARN_ON(__big_tty_mutex_owner == task);
29
30 mutex_lock(&big_tty_mutex); 24 mutex_lock(&big_tty_mutex);
31 __big_tty_mutex_owner = task;
32} 25}
33EXPORT_SYMBOL(tty_lock); 26EXPORT_SYMBOL(tty_lock);
34 27
35void __lockfunc tty_unlock(void) 28void __lockfunc tty_unlock(void)
36{ 29{
37 struct task_struct *task = current;
38
39 WARN_ON(__big_tty_mutex_owner != task);
40 __big_tty_mutex_owner = NULL;
41
42 mutex_unlock(&big_tty_mutex); 30 mutex_unlock(&big_tty_mutex);
43} 31}
44EXPORT_SYMBOL(tty_unlock); 32EXPORT_SYMBOL(tty_unlock);
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
index fb864e7fcd13..7a0a12ae5458 100644
--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@ -301,6 +301,8 @@ int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *t
301/* Insert the contents of the selection buffer into the 301/* Insert the contents of the selection buffer into the
302 * queue of the tty associated with the current console. 302 * queue of the tty associated with the current console.
303 * Invoked by ioctl(). 303 * Invoked by ioctl().
304 *
305 * Locking: always called with BTM from vt_ioctl
304 */ 306 */
305int paste_selection(struct tty_struct *tty) 307int paste_selection(struct tty_struct *tty)
306{ 308{
@@ -310,8 +312,6 @@ int paste_selection(struct tty_struct *tty)
310 struct tty_ldisc *ld; 312 struct tty_ldisc *ld;
311 DECLARE_WAITQUEUE(wait, current); 313 DECLARE_WAITQUEUE(wait, current);
312 314
313 /* always called with BTM from vt_ioctl */
314 WARN_ON(!tty_locked());
315 315
316 console_lock(); 316 console_lock();
317 poke_blanked_console(); 317 poke_blanked_console();