Arnd Bergmann | b07471f | 2010-08-06 21:40:30 +0200 | [diff] [blame] | 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> |
| 6 | |
| 7 | /* |
| 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 | */ |
| 17 | static DEFINE_MUTEX(big_tty_mutex); |
Arnd Bergmann | b07471f | 2010-08-06 21:40:30 +0200 | [diff] [blame] | 18 | |
| 19 | /* |
| 20 | * Getting the big tty mutex. |
| 21 | */ |
| 22 | void __lockfunc tty_lock(void) |
| 23 | { |
Arnd Bergmann | b07471f | 2010-08-06 21:40:30 +0200 | [diff] [blame] | 24 | mutex_lock(&big_tty_mutex); |
Arnd Bergmann | b07471f | 2010-08-06 21:40:30 +0200 | [diff] [blame] | 25 | } |
| 26 | EXPORT_SYMBOL(tty_lock); |
| 27 | |
| 28 | void __lockfunc tty_unlock(void) |
| 29 | { |
Arnd Bergmann | b07471f | 2010-08-06 21:40:30 +0200 | [diff] [blame] | 30 | mutex_unlock(&big_tty_mutex); |
| 31 | } |
| 32 | EXPORT_SYMBOL(tty_unlock); |