aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2009-01-02 08:45:58 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 13:19:39 -0500
commit3b6826b250633361f08a6427a4ac0035e5d88c72 (patch)
tree68126130a079ad732f00167d225f31cd65032957 /drivers/char
parentc2ba38cd76df770a253f0cab4b6abe514c265a85 (diff)
tty: relock the mxser driver
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/mxser.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index ff5ff6188809..e2471cf1ee95 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -591,11 +591,11 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp,
591 retval = 0; 591 retval = 0;
592 add_wait_queue(&port->open_wait, &wait); 592 add_wait_queue(&port->open_wait, &wait);
593 593
594 spin_lock_irqsave(&mp->slock, flags); 594 spin_lock_irqsave(&port->lock, flags);
595 if (!tty_hung_up_p(filp)) 595 if (!tty_hung_up_p(filp))
596 port->count--; 596 port->count--;
597 spin_unlock_irqrestore(&mp->slock, flags);
598 port->blocked_open++; 597 port->blocked_open++;
598 spin_unlock_irqrestore(&port->lock, flags);
599 while (1) { 599 while (1) {
600 tty_port_raise_dtr_rts(port); 600 tty_port_raise_dtr_rts(port);
601 set_current_state(TASK_INTERRUPTIBLE); 601 set_current_state(TASK_INTERRUPTIBLE);
@@ -617,12 +617,13 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp,
617 } 617 }
618 set_current_state(TASK_RUNNING); 618 set_current_state(TASK_RUNNING);
619 remove_wait_queue(&port->open_wait, &wait); 619 remove_wait_queue(&port->open_wait, &wait);
620 spin_lock_irqsave(&port->lock, flags);
620 if (!tty_hung_up_p(filp)) 621 if (!tty_hung_up_p(filp))
621 port->count++; 622 port->count++;
622 port->blocked_open--; 623 port->blocked_open--;
623 if (retval) 624 if (retval == 0)
624 return retval; 625 port->flags |= ASYNC_NORMAL_ACTIVE;
625 port->flags |= ASYNC_NORMAL_ACTIVE; 626 spin_unlock_irqrestore(&port->lock, flags);
626 return 0; 627 return 0;
627} 628}
628 629
@@ -1102,9 +1103,9 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
1102 /* 1103 /*
1103 * Start up serial port 1104 * Start up serial port
1104 */ 1105 */
1105 spin_lock_irqsave(&info->slock, flags); 1106 spin_lock_irqsave(&info->port.lock, flags);
1106 info->port.count++; 1107 info->port.count++;
1107 spin_unlock_irqrestore(&info->slock, flags); 1108 spin_unlock_irqrestore(&info->port.lock, flags);
1108 retval = mxser_startup(tty); 1109 retval = mxser_startup(tty);
1109 if (retval) 1110 if (retval)
1110 return retval; 1111 return retval;
@@ -1157,10 +1158,10 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
1157 if (!info) 1158 if (!info)
1158 return; 1159 return;
1159 1160
1160 spin_lock_irqsave(&info->slock, flags); 1161 spin_lock_irqsave(&info->port.lock, flags);
1161 1162
1162 if (tty_hung_up_p(filp)) { 1163 if (tty_hung_up_p(filp)) {
1163 spin_unlock_irqrestore(&info->slock, flags); 1164 spin_unlock_irqrestore(&info->port.lock, flags);
1164 return; 1165 return;
1165 } 1166 }
1166 if ((tty->count == 1) && (info->port.count != 1)) { 1167 if ((tty->count == 1) && (info->port.count != 1)) {
@@ -1181,11 +1182,11 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
1181 info->port.count = 0; 1182 info->port.count = 0;
1182 } 1183 }
1183 if (info->port.count) { 1184 if (info->port.count) {
1184 spin_unlock_irqrestore(&info->slock, flags); 1185 spin_unlock_irqrestore(&info->port.lock, flags);
1185 return; 1186 return;
1186 } 1187 }
1187 info->port.flags |= ASYNC_CLOSING; 1188 info->port.flags |= ASYNC_CLOSING;
1188 spin_unlock_irqrestore(&info->slock, flags); 1189 spin_unlock_irqrestore(&info->port.lock, flags);
1189 /* 1190 /*
1190 * Save the termios structure, since this port may have 1191 * Save the termios structure, since this port may have
1191 * separate termios for callout and dialin. 1192 * separate termios for callout and dialin.
@@ -2161,10 +2162,7 @@ static void mxser_hangup(struct tty_struct *tty)
2161 2162
2162 mxser_flush_buffer(tty); 2163 mxser_flush_buffer(tty);
2163 mxser_shutdown(tty); 2164 mxser_shutdown(tty);
2164 info->port.count = 0; 2165 tty_port_hangup(&info->port);
2165 info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
2166 tty_port_tty_set(&info->port, NULL);
2167 wake_up_interruptible(&info->port.open_wait);
2168} 2166}
2169 2167
2170/* 2168/*