aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/tty.h
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2012-08-08 11:30:13 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-10 15:55:47 -0400
commit89c8d91e31f267703e365593f6bfebb9f6d2ad01 (patch)
treeb115c7738762abe4a8a6374debb4991382b2f785 /include/linux/tty.h
parentdc6802a771e91050fb686dfeeb9de4c6c9cadb79 (diff)
tty: localise the lock
The termios and other changes mean the other protections needed on the driver tty arrays should be adequate. Turn it all back on. This contains pieces folded in from the fixes made to the original patches | From: Geert Uytterhoeven <geert@linux-m68k.org> (fix m68k) | From: Paul Gortmaker <paul.gortmaker@windriver.com> (fix cris) | From: Jiri Kosina <jkosina@suze.cz> (lockdep) | From: Eric Dumazet <eric.dumazet@gmail.com> (lockdep) Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r--include/linux/tty.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index a39e72325e78..acca24bf06a7 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -268,6 +268,7 @@ struct tty_struct {
268 struct mutex ldisc_mutex; 268 struct mutex ldisc_mutex;
269 struct tty_ldisc *ldisc; 269 struct tty_ldisc *ldisc;
270 270
271 struct mutex legacy_mutex;
271 struct mutex termios_mutex; 272 struct mutex termios_mutex;
272 spinlock_t ctrl_lock; 273 spinlock_t ctrl_lock;
273 /* Termios values are protected by the termios mutex */ 274 /* Termios values are protected by the termios mutex */
@@ -609,8 +610,12 @@ extern long vt_compat_ioctl(struct tty_struct *tty,
609 610
610/* tty_mutex.c */ 611/* tty_mutex.c */
611/* functions for preparation of BKL removal */ 612/* functions for preparation of BKL removal */
612extern void __lockfunc tty_lock(void) __acquires(tty_lock); 613extern void __lockfunc tty_lock(struct tty_struct *tty);
613extern void __lockfunc tty_unlock(void) __releases(tty_lock); 614extern void __lockfunc tty_unlock(struct tty_struct *tty);
615extern void __lockfunc tty_lock_pair(struct tty_struct *tty,
616 struct tty_struct *tty2);
617extern void __lockfunc tty_unlock_pair(struct tty_struct *tty,
618 struct tty_struct *tty2);
614 619
615/* 620/*
616 * this shall be called only from where BTM is held (like close) 621 * this shall be called only from where BTM is held (like close)
@@ -625,9 +630,9 @@ extern void __lockfunc tty_unlock(void) __releases(tty_lock);
625static inline void tty_wait_until_sent_from_close(struct tty_struct *tty, 630static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
626 long timeout) 631 long timeout)
627{ 632{
628 tty_unlock(); /* tty->ops->close holds the BTM, drop it while waiting */ 633 tty_unlock(tty); /* tty->ops->close holds the BTM, drop it while waiting */
629 tty_wait_until_sent(tty, timeout); 634 tty_wait_until_sent(tty, timeout);
630 tty_lock(); 635 tty_lock(tty);
631} 636}
632 637
633/* 638/*
@@ -642,16 +647,16 @@ static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
642 * 647 *
643 * Do not use in new code. 648 * Do not use in new code.
644 */ 649 */
645#define wait_event_interruptible_tty(wq, condition) \ 650#define wait_event_interruptible_tty(tty, wq, condition) \
646({ \ 651({ \
647 int __ret = 0; \ 652 int __ret = 0; \
648 if (!(condition)) { \ 653 if (!(condition)) { \
649 __wait_event_interruptible_tty(wq, condition, __ret); \ 654 __wait_event_interruptible_tty(tty, wq, condition, __ret); \
650 } \ 655 } \
651 __ret; \ 656 __ret; \
652}) 657})
653 658
654#define __wait_event_interruptible_tty(wq, condition, ret) \ 659#define __wait_event_interruptible_tty(tty, wq, condition, ret) \
655do { \ 660do { \
656 DEFINE_WAIT(__wait); \ 661 DEFINE_WAIT(__wait); \
657 \ 662 \
@@ -660,9 +665,9 @@ do { \
660 if (condition) \ 665 if (condition) \
661 break; \ 666 break; \
662 if (!signal_pending(current)) { \ 667 if (!signal_pending(current)) { \
663 tty_unlock(); \ 668 tty_unlock(tty); \
664 schedule(); \ 669 schedule(); \
665 tty_lock(); \ 670 tty_lock(tty); \
666 continue; \ 671 continue; \
667 } \ 672 } \
668 ret = -ERESTARTSYS; \ 673 ret = -ERESTARTSYS; \