diff options
-rw-r--r-- | drivers/tty/tty_ldisc.c | 7 | ||||
-rw-r--r-- | include/linux/tty_ldisc.h | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index fa65cde395a4..173a9000a6cb 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c | |||
@@ -28,7 +28,6 @@ | |||
28 | 28 | ||
29 | static DEFINE_SPINLOCK(tty_ldisc_lock); | 29 | static DEFINE_SPINLOCK(tty_ldisc_lock); |
30 | static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait); | 30 | static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait); |
31 | static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_idle); | ||
32 | /* Line disc dispatch table */ | 31 | /* Line disc dispatch table */ |
33 | static struct tty_ldisc_ops *tty_ldiscs[NR_LDISCS]; | 32 | static struct tty_ldisc_ops *tty_ldiscs[NR_LDISCS]; |
34 | 33 | ||
@@ -65,7 +64,7 @@ static void put_ldisc(struct tty_ldisc *ld) | |||
65 | return; | 64 | return; |
66 | } | 65 | } |
67 | local_irq_restore(flags); | 66 | local_irq_restore(flags); |
68 | wake_up(&tty_ldisc_idle); | 67 | wake_up(&ld->wq_idle); |
69 | } | 68 | } |
70 | 69 | ||
71 | /** | 70 | /** |
@@ -200,6 +199,8 @@ static struct tty_ldisc *tty_ldisc_get(int disc) | |||
200 | 199 | ||
201 | ld->ops = ldops; | 200 | ld->ops = ldops; |
202 | atomic_set(&ld->users, 1); | 201 | atomic_set(&ld->users, 1); |
202 | init_waitqueue_head(&ld->wq_idle); | ||
203 | |||
203 | return ld; | 204 | return ld; |
204 | } | 205 | } |
205 | 206 | ||
@@ -538,7 +539,7 @@ static void tty_ldisc_flush_works(struct tty_struct *tty) | |||
538 | static int tty_ldisc_wait_idle(struct tty_struct *tty, long timeout) | 539 | static int tty_ldisc_wait_idle(struct tty_struct *tty, long timeout) |
539 | { | 540 | { |
540 | long ret; | 541 | long ret; |
541 | ret = wait_event_timeout(tty_ldisc_idle, | 542 | ret = wait_event_timeout(tty->ldisc->wq_idle, |
542 | atomic_read(&tty->ldisc->users) == 1, timeout); | 543 | atomic_read(&tty->ldisc->users) == 1, timeout); |
543 | return ret > 0 ? 0 : -EBUSY; | 544 | return ret > 0 ? 0 : -EBUSY; |
544 | } | 545 | } |
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index ff7dc08696a8..fb79dd8d1537 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h | |||
@@ -110,6 +110,7 @@ | |||
110 | #include <linux/fs.h> | 110 | #include <linux/fs.h> |
111 | #include <linux/wait.h> | 111 | #include <linux/wait.h> |
112 | #include <linux/pps_kernel.h> | 112 | #include <linux/pps_kernel.h> |
113 | #include <linux/wait.h> | ||
113 | 114 | ||
114 | struct tty_ldisc_ops { | 115 | struct tty_ldisc_ops { |
115 | int magic; | 116 | int magic; |
@@ -154,6 +155,7 @@ struct tty_ldisc_ops { | |||
154 | struct tty_ldisc { | 155 | struct tty_ldisc { |
155 | struct tty_ldisc_ops *ops; | 156 | struct tty_ldisc_ops *ops; |
156 | atomic_t users; | 157 | atomic_t users; |
158 | wait_queue_head_t wq_idle; | ||
157 | }; | 159 | }; |
158 | 160 | ||
159 | #define TTY_LDISC_MAGIC 0x5403 | 161 | #define TTY_LDISC_MAGIC 0x5403 |