tty: Make lock subclasses available for other tty locks
authorPeter Hurley <peter@hurleysoftware.com>
Sat, 17 Jan 2015 20:42:04 +0000 (15:42 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Feb 2015 18:11:27 +0000 (10:11 -0800)
Besides nested legacy_mutex locking which is required on pty pair
teardown, other nested pty operations require lock subclassing.

Move lock subclass definition to tty interface header, include/linux/tty.h,
and document its use.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/tty_mutex.c
include/linux/tty.h

index a872389..0efcf71 100644 (file)
@@ -4,18 +4,8 @@
 #include <linux/semaphore.h>
 #include <linux/sched.h>
 
-/*
- * Nested tty locks are necessary for releasing pty pairs.
- * The stable lock order is master pty first, then slave pty.
- */
-
 /* Legacy tty mutex glue */
 
-enum {
-       TTY_MUTEX_NORMAL,
-       TTY_MUTEX_SLAVE,
-};
-
 /*
  * Getting the big tty mutex.
  */
@@ -58,5 +48,5 @@ void __lockfunc tty_unlock_slave(struct tty_struct *tty)
 
 void tty_set_lock_subclass(struct tty_struct *tty)
 {
-       lockdep_set_subclass(&tty->legacy_mutex, TTY_MUTEX_SLAVE);
+       lockdep_set_subclass(&tty->legacy_mutex, TTY_LOCK_SLAVE);
 }
Simple merge