aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/moxa.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/moxa.c')
-rw-r--r--drivers/char/moxa.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index 40ac6dedee46..2fc255a21486 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -41,6 +41,7 @@
41#include <linux/pci.h> 41#include <linux/pci.h>
42#include <linux/init.h> 42#include <linux/init.h>
43#include <linux/bitops.h> 43#include <linux/bitops.h>
44#include <linux/completion.h>
44 45
45#include <asm/system.h> 46#include <asm/system.h>
46#include <asm/io.h> 47#include <asm/io.h>
@@ -142,7 +143,7 @@ struct moxa_port {
142 struct tty_struct *tty; 143 struct tty_struct *tty;
143 int cflag; 144 int cflag;
144 wait_queue_head_t open_wait; 145 wait_queue_head_t open_wait;
145 wait_queue_head_t close_wait; 146 struct completion close_wait;
146 147
147 struct timer_list emptyTimer; 148 struct timer_list emptyTimer;
148 149
@@ -374,7 +375,7 @@ static int __init moxa_init(void)
374 ch->closing_wait = 30 * HZ; 375 ch->closing_wait = 30 * HZ;
375 ch->cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL; 376 ch->cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL;
376 init_waitqueue_head(&ch->open_wait); 377 init_waitqueue_head(&ch->open_wait);
377 init_waitqueue_head(&ch->close_wait); 378 init_completion(&ch->close_wait);
378 379
379 setup_timer(&ch->emptyTimer, moxa_check_xmit_empty, 380 setup_timer(&ch->emptyTimer, moxa_check_xmit_empty,
380 (unsigned long)ch); 381 (unsigned long)ch);
@@ -577,7 +578,7 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
577 wake_up_interruptible(&ch->open_wait); 578 wake_up_interruptible(&ch->open_wait);
578 } 579 }
579 ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); 580 ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING);
580 wake_up_interruptible(&ch->close_wait); 581 complete_all(&ch->close_wait);
581} 582}
582 583
583static int moxa_write(struct tty_struct *tty, 584static int moxa_write(struct tty_struct *tty,
@@ -941,7 +942,7 @@ static int moxa_block_till_ready(struct tty_struct *tty, struct file *filp,
941 */ 942 */
942 if (tty_hung_up_p(filp) || (ch->asyncflags & ASYNC_CLOSING)) { 943 if (tty_hung_up_p(filp) || (ch->asyncflags & ASYNC_CLOSING)) {
943 if (ch->asyncflags & ASYNC_CLOSING) 944 if (ch->asyncflags & ASYNC_CLOSING)
944 interruptible_sleep_on(&ch->close_wait); 945 wait_for_completion_interruptible(&ch->close_wait);
945#ifdef SERIAL_DO_RESTART 946#ifdef SERIAL_DO_RESTART
946 if (ch->asyncflags & ASYNC_HUP_NOTIFY) 947 if (ch->asyncflags & ASYNC_HUP_NOTIFY)
947 return (-EAGAIN); 948 return (-EAGAIN);