2 #include <linux/module.h>
3 #include <linux/kallsyms.h>
4 #include <linux/semaphore.h>
5 #include <linux/sched.h>
7 /* Legacy tty mutex glue */
10 * Getting the big tty mutex.
13 void __lockfunc tty_lock(struct tty_struct *tty)
15 if (tty->magic != TTY_MAGIC) {
16 pr_err("L Bad %p\n", tty);
21 mutex_lock(&tty->legacy_mutex);
23 EXPORT_SYMBOL(tty_lock);
25 int tty_lock_interruptible(struct tty_struct *tty)
29 if (WARN(tty->magic != TTY_MAGIC, "L Bad %p\n", tty))
32 ret = mutex_lock_interruptible(&tty->legacy_mutex);
38 void __lockfunc tty_unlock(struct tty_struct *tty)
40 if (tty->magic != TTY_MAGIC) {
41 pr_err("U Bad %p\n", tty);
45 mutex_unlock(&tty->legacy_mutex);
48 EXPORT_SYMBOL(tty_unlock);
50 void __lockfunc tty_lock_slave(struct tty_struct *tty)
52 if (tty && tty != tty->link)
56 void __lockfunc tty_unlock_slave(struct tty_struct *tty)
58 if (tty && tty != tty->link)
62 void tty_set_lock_subclass(struct tty_struct *tty)
64 lockdep_set_subclass(&tty->legacy_mutex, TTY_LOCK_SLAVE);