x86: cache_info: Kill the atomic allocation in amd_init_l3_cache()
[linux-2.6/linux-mips.git] / drivers / tty / tty_mutex.c
blob3b2bb77194423fa3c3967f21916d64bd94513584
1 #include <linux/tty.h>
2 #include <linux/module.h>
3 #include <linux/kallsyms.h>
4 #include <linux/semaphore.h>
5 #include <linux/sched.h>
7 /*
8 * The 'big tty mutex'
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.
15 * Don't use in new code.
17 static DEFINE_MUTEX(big_tty_mutex);
18 struct task_struct *__big_tty_mutex_owner;
19 EXPORT_SYMBOL_GPL(__big_tty_mutex_owner);
22 * Getting the big tty mutex.
24 void __lockfunc tty_lock(void)
26 struct task_struct *task = current;
28 WARN_ON(__big_tty_mutex_owner == task);
30 mutex_lock(&big_tty_mutex);
31 __big_tty_mutex_owner = task;
33 EXPORT_SYMBOL(tty_lock);
35 void __lockfunc tty_unlock(void)
37 struct task_struct *task = current;
39 WARN_ON(__big_tty_mutex_owner != task);
40 __big_tty_mutex_owner = NULL;
42 mutex_unlock(&big_tty_mutex);
44 EXPORT_SYMBOL(tty_unlock);