f43e995c7a0fc8a64ae1ee41eb2c7afa418df5b4
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 static void __lockfunc
tty_lock_nested(struct tty_struct
*tty
,
24 unsigned int subclass
)
26 if (tty
->magic
!= TTY_MAGIC
) {
27 pr_err("L Bad %p\n", tty
);
32 mutex_lock_nested(&tty
->legacy_mutex
, subclass
);
35 void __lockfunc
tty_lock(struct tty_struct
*tty
)
37 return tty_lock_nested(tty
, TTY_MUTEX_NORMAL
);
39 EXPORT_SYMBOL(tty_lock
);
41 void __lockfunc
tty_unlock(struct tty_struct
*tty
)
43 if (tty
->magic
!= TTY_MAGIC
) {
44 pr_err("U Bad %p\n", tty
);
48 mutex_unlock(&tty
->legacy_mutex
);
51 EXPORT_SYMBOL(tty_unlock
);
53 void __lockfunc
tty_lock_slave(struct tty_struct
*tty
)
55 if (tty
&& tty
!= tty
->link
) {
56 WARN_ON(!mutex_is_locked(&tty
->link
->legacy_mutex
) ||
57 !tty
->driver
->type
== TTY_DRIVER_TYPE_PTY
||
58 !tty
->driver
->type
== PTY_TYPE_SLAVE
);
59 tty_lock_nested(tty
, TTY_MUTEX_NESTED
);
63 void __lockfunc
tty_unlock_slave(struct tty_struct
*tty
)
65 if (tty
&& tty
!= tty
->link
)
This page took 0.036882 seconds and 4 git commands to generate.