blob: 9ff986c32a21ef702edf515a79c19440a504b747 [file] [log] [blame]
Arnd Bergmannb07471f2010-08-06 21:40:30 +02001#include <linux/tty.h>
2#include <linux/module.h>
3#include <linux/kallsyms.h>
4#include <linux/semaphore.h>
5#include <linux/sched.h>
6
Linus Torvaldsf3095322012-06-02 15:21:43 -07007/*
8 * The 'big tty mutex'
9 *
10 * This mutex is taken and released by tty_lock() and tty_unlock(),
11 * replacing the older big kernel lock.
12 * It can no longer be taken recursively, and does not get
13 * released implicitly while sleeping.
14 *
15 * Don't use in new code.
16 */
17static DEFINE_MUTEX(big_tty_mutex);
Eric Dumazetfde86d32012-05-31 11:35:18 +020018
Arnd Bergmannb07471f2010-08-06 21:40:30 +020019/*
20 * Getting the big tty mutex.
21 */
Linus Torvaldsf3095322012-06-02 15:21:43 -070022void __lockfunc tty_lock(void)
Arnd Bergmannb07471f2010-08-06 21:40:30 +020023{
Linus Torvaldsf3095322012-06-02 15:21:43 -070024 mutex_lock(&big_tty_mutex);
Arnd Bergmannb07471f2010-08-06 21:40:30 +020025}
26EXPORT_SYMBOL(tty_lock);
27
Linus Torvaldsf3095322012-06-02 15:21:43 -070028void __lockfunc tty_unlock(void)
Arnd Bergmannb07471f2010-08-06 21:40:30 +020029{
Linus Torvaldsf3095322012-06-02 15:21:43 -070030 mutex_unlock(&big_tty_mutex);
Arnd Bergmannb07471f2010-08-06 21:40:30 +020031}
32EXPORT_SYMBOL(tty_unlock);