diff options
Diffstat (limited to 'drivers/usb/serial/mct_u232.c')
-rw-r--r-- | drivers/usb/serial/mct_u232.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index 88b2074867c5..fc1cea4aba13 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
@@ -487,21 +487,22 @@ error: | |||
487 | static void mct_u232_close (struct usb_serial_port *port, struct file *filp) | 487 | static void mct_u232_close (struct usb_serial_port *port, struct file *filp) |
488 | { | 488 | { |
489 | unsigned int c_cflag; | 489 | unsigned int c_cflag; |
490 | unsigned long flags; | ||
491 | unsigned int control_state; | 490 | unsigned int control_state; |
492 | struct mct_u232_private *priv = usb_get_serial_port_data(port); | 491 | struct mct_u232_private *priv = usb_get_serial_port_data(port); |
493 | dbg("%s port %d", __FUNCTION__, port->number); | 492 | dbg("%s port %d", __FUNCTION__, port->number); |
494 | 493 | ||
495 | if (port->tty) { | 494 | if (port->tty) { |
496 | c_cflag = port->tty->termios->c_cflag; | 495 | c_cflag = port->tty->termios->c_cflag; |
497 | if (c_cflag & HUPCL) { | 496 | mutex_lock(&port->serial->disc_mutex); |
498 | /* drop DTR and RTS */ | 497 | if (c_cflag & HUPCL && !port->serial->disconnected) { |
499 | spin_lock_irqsave(&priv->lock, flags); | 498 | /* drop DTR and RTS */ |
500 | priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS); | 499 | spin_lock_irq(&priv->lock); |
501 | control_state = priv->control_state; | 500 | priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS); |
502 | spin_unlock_irqrestore(&priv->lock, flags); | 501 | control_state = priv->control_state; |
503 | mct_u232_set_modem_ctrl(port->serial, control_state); | 502 | spin_unlock_irq(&priv->lock); |
503 | mct_u232_set_modem_ctrl(port->serial, control_state); | ||
504 | } | 504 | } |
505 | mutex_unlock(&port->serial->disc_mutex); | ||
505 | } | 506 | } |
506 | 507 | ||
507 | 508 | ||