aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/rocket.c12
-rw-r--r--drivers/char/rocket_int.h7
2 files changed, 9 insertions, 10 deletions
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 56cbba7b6ec0..d790b08525b4 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -84,6 +84,7 @@
84#include <linux/mutex.h> 84#include <linux/mutex.h>
85#include <linux/ioport.h> 85#include <linux/ioport.h>
86#include <linux/delay.h> 86#include <linux/delay.h>
87#include <linux/completion.h>
87#include <linux/wait.h> 88#include <linux/wait.h>
88#include <linux/pci.h> 89#include <linux/pci.h>
89#include <asm/uaccess.h> 90#include <asm/uaccess.h>
@@ -650,7 +651,7 @@ static void init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev)
650 info->closing_wait = 3000; 651 info->closing_wait = 3000;
651 info->close_delay = 50; 652 info->close_delay = 50;
652 init_waitqueue_head(&info->open_wait); 653 init_waitqueue_head(&info->open_wait);
653 init_waitqueue_head(&info->close_wait); 654 init_completion(&info->close_wait);
654 info->flags &= ~ROCKET_MODE_MASK; 655 info->flags &= ~ROCKET_MODE_MASK;
655 switch (pc104[board][line]) { 656 switch (pc104[board][line]) {
656 case 422: 657 case 422:
@@ -878,7 +879,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
878 if (tty_hung_up_p(filp)) 879 if (tty_hung_up_p(filp))
879 return ((info->flags & ROCKET_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS); 880 return ((info->flags & ROCKET_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS);
880 if (info->flags & ROCKET_CLOSING) { 881 if (info->flags & ROCKET_CLOSING) {
881 interruptible_sleep_on(&info->close_wait); 882 if (wait_for_completion_interruptible(&info->close_wait))
883 return -ERESTARTSYS;
882 return ((info->flags & ROCKET_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS); 884 return ((info->flags & ROCKET_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS);
883 } 885 }
884 886
@@ -983,8 +985,10 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
983 return -ENOMEM; 985 return -ENOMEM;
984 986
985 if (info->flags & ROCKET_CLOSING) { 987 if (info->flags & ROCKET_CLOSING) {
986 interruptible_sleep_on(&info->close_wait); 988 retval = wait_for_completion_interruptible(&info->close_wait);
987 free_page(page); 989 free_page(page);
990 if (retval)
991 return retval;
988 return ((info->flags & ROCKET_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS); 992 return ((info->flags & ROCKET_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS);
989 } 993 }
990 994
@@ -1176,7 +1180,7 @@ static void rp_close(struct tty_struct *tty, struct file *filp)
1176 } 1180 }
1177 info->flags &= ~(ROCKET_INITIALIZED | ROCKET_CLOSING | ROCKET_NORMAL_ACTIVE); 1181 info->flags &= ~(ROCKET_INITIALIZED | ROCKET_CLOSING | ROCKET_NORMAL_ACTIVE);
1178 tty->closing = 0; 1182 tty->closing = 0;
1179 wake_up_interruptible(&info->close_wait); 1183 complete_all(&info->close_wait);
1180 atomic_dec(&rp_num_ports_open); 1184 atomic_dec(&rp_num_ports_open);
1181 1185
1182#ifdef ROCKET_DEBUG_OPEN 1186#ifdef ROCKET_DEBUG_OPEN
diff --git a/drivers/char/rocket_int.h b/drivers/char/rocket_int.h
index b4c53dfa7951..55b8f2d71a96 100644
--- a/drivers/char/rocket_int.h
+++ b/drivers/char/rocket_int.h
@@ -1163,13 +1163,8 @@ struct r_port {
1163 int read_status_mask; 1163 int read_status_mask;
1164 int cps; 1164 int cps;
1165 1165
1166#ifdef DECLARE_WAITQUEUE
1167 wait_queue_head_t open_wait; 1166 wait_queue_head_t open_wait;
1168 wait_queue_head_t close_wait; 1167 struct completion close_wait;
1169#else
1170 struct wait_queue *open_wait;
1171 struct wait_queue *close_wait;
1172#endif
1173 spinlock_t slock; 1168 spinlock_t slock;
1174 struct mutex write_mtx; 1169 struct mutex write_mtx;
1175}; 1170};