aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/quatech2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/quatech2.c')
-rw-r--r--drivers/usb/serial/quatech2.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
index 00e6c9bac8a3..75f125ddb0c9 100644
--- a/drivers/usb/serial/quatech2.c
+++ b/drivers/usb/serial/quatech2.c
@@ -128,7 +128,6 @@ struct qt2_port_private {
128 u8 shadowLSR; 128 u8 shadowLSR;
129 u8 shadowMSR; 129 u8 shadowMSR;
130 130
131 wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
132 struct async_icount icount; 131 struct async_icount icount;
133 132
134 struct usb_serial_port *port; 133 struct usb_serial_port *port;
@@ -506,8 +505,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
506 spin_unlock_irqrestore(&priv->lock, flags); 505 spin_unlock_irqrestore(&priv->lock, flags);
507 506
508 while (1) { 507 while (1) {
509 wait_event_interruptible(priv->delta_msr_wait, 508 wait_event_interruptible(port->delta_msr_wait,
510 ((priv->icount.rng != prev.rng) || 509 (port->serial->disconnected ||
510 (priv->icount.rng != prev.rng) ||
511 (priv->icount.dsr != prev.dsr) || 511 (priv->icount.dsr != prev.dsr) ||
512 (priv->icount.dcd != prev.dcd) || 512 (priv->icount.dcd != prev.dcd) ||
513 (priv->icount.cts != prev.cts))); 513 (priv->icount.cts != prev.cts)));
@@ -515,6 +515,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
515 if (signal_pending(current)) 515 if (signal_pending(current))
516 return -ERESTARTSYS; 516 return -ERESTARTSYS;
517 517
518 if (port->serial->disconnected)
519 return -EIO;
520
518 spin_lock_irqsave(&priv->lock, flags); 521 spin_lock_irqsave(&priv->lock, flags);
519 cur = priv->icount; 522 cur = priv->icount;
520 spin_unlock_irqrestore(&priv->lock, flags); 523 spin_unlock_irqrestore(&priv->lock, flags);
@@ -661,7 +664,9 @@ void qt2_process_read_urb(struct urb *urb)
661 __func__); 664 __func__);
662 break; 665 break;
663 } 666 }
664 tty_flip_buffer_push(&port->port); 667
668 if (port_priv->is_open)
669 tty_flip_buffer_push(&port->port);
665 670
666 newport = *(ch + 3); 671 newport = *(ch + 3);
667 672
@@ -704,7 +709,8 @@ void qt2_process_read_urb(struct urb *urb)
704 tty_insert_flip_string(&port->port, ch, 1); 709 tty_insert_flip_string(&port->port, ch, 1);
705 } 710 }
706 711
707 tty_flip_buffer_push(&port->port); 712 if (port_priv->is_open)
713 tty_flip_buffer_push(&port->port);
708} 714}
709 715
710static void qt2_write_bulk_callback(struct urb *urb) 716static void qt2_write_bulk_callback(struct urb *urb)
@@ -824,7 +830,6 @@ static int qt2_port_probe(struct usb_serial_port *port)
824 830
825 spin_lock_init(&port_priv->lock); 831 spin_lock_init(&port_priv->lock);
826 spin_lock_init(&port_priv->urb_lock); 832 spin_lock_init(&port_priv->urb_lock);
827 init_waitqueue_head(&port_priv->delta_msr_wait);
828 port_priv->port = port; 833 port_priv->port = port;
829 834
830 port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL); 835 port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL);
@@ -967,7 +972,7 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch)
967 if (newMSR & UART_MSR_TERI) 972 if (newMSR & UART_MSR_TERI)
968 port_priv->icount.rng++; 973 port_priv->icount.rng++;
969 974
970 wake_up_interruptible(&port_priv->delta_msr_wait); 975 wake_up_interruptible(&port->delta_msr_wait);
971 } 976 }
972} 977}
973 978