2 #include <linux/module.h>
3 #include <linux/kallsyms.h>
4 #include <linux/semaphore.h>
5 #include <linux/sched.h>
8 * Nested tty locks are necessary for releasing pty pairs.
9 * The stable lock order is master pty first, then slave pty.
12 /* Legacy tty mutex glue */
20 * Getting the big tty mutex.
23 void __lockfunc
tty_lock(struct tty_struct
*tty
)
25 if (tty
->magic
!= TTY_MAGIC
) {
26 pr_err("L Bad %p\n", tty
);
31 mutex_lock(&tty
->legacy_mutex
);
33 EXPORT_SYMBOL(tty_lock
);
35 void __lockfunc
tty_unlock(struct tty_struct
*tty
)
37 if (tty
->magic
!= TTY_MAGIC
) {
38 pr_err("U Bad %p\n", tty
);
42 mutex_unlock(&tty
->legacy_mutex
);
45 EXPORT_SYMBOL(tty_unlock
);
47 void __lockfunc
tty_lock_slave(struct tty_struct
*tty
)
49 if (tty
&& tty
!= tty
->link
) {
50 WARN_ON(!mutex_is_locked(&tty
->link
->legacy_mutex
) ||
51 !tty
->driver
->type
== TTY_DRIVER_TYPE_PTY
||
52 !tty
->driver
->type
== PTY_TYPE_SLAVE
);
57 void __lockfunc
tty_unlock_slave(struct tty_struct
*tty
)
59 if (tty
&& tty
!= tty
->link
)
63 void tty_set_lock_subclass(struct tty_struct
*tty
)
65 lockdep_set_subclass(&tty
->legacy_mutex
, TTY_MUTEX_SLAVE
);
This page took 0.031704 seconds and 5 git commands to generate.