aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_mutex.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/tty_mutex.c')
-rw-r--r--drivers/tty/tty_mutex.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/tty/tty_mutex.c b/drivers/tty/tty_mutex.c
index 77703a391207..dfa9ec03fa8e 100644
--- a/drivers/tty/tty_mutex.c
+++ b/drivers/tty/tty_mutex.c
@@ -19,6 +19,19 @@ void __lockfunc tty_lock(struct tty_struct *tty)
19} 19}
20EXPORT_SYMBOL(tty_lock); 20EXPORT_SYMBOL(tty_lock);
21 21
22int tty_lock_interruptible(struct tty_struct *tty)
23{
24 int ret;
25
26 if (WARN(tty->magic != TTY_MAGIC, "L Bad %p\n", tty))
27 return -EIO;
28 tty_kref_get(tty);
29 ret = mutex_lock_interruptible(&tty->legacy_mutex);
30 if (ret)
31 tty_kref_put(tty);
32 return ret;
33}
34
22void __lockfunc tty_unlock(struct tty_struct *tty) 35void __lockfunc tty_unlock(struct tty_struct *tty)
23{ 36{
24 if (WARN(tty->magic != TTY_MAGIC, "U Bad %p\n", tty)) 37 if (WARN(tty->magic != TTY_MAGIC, "U Bad %p\n", tty))