|
@@ -686,15 +686,21 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
|
|
|
|
|
|
/* Perform the closing process and see if we need to do the hardware
|
|
|
shutdown */
|
|
|
- if (!acm || tty_port_close_start(&acm->port, tty, filp) == 0)
|
|
|
+ if (!acm)
|
|
|
+ return;
|
|
|
+ if (tty_port_close_start(&acm->port, tty, filp) == 0) {
|
|
|
+ mutex_lock(&open_mutex);
|
|
|
+ if (!acm->dev) {
|
|
|
+ tty_port_tty_set(&acm->port, NULL);
|
|
|
+ acm_tty_unregister(acm);
|
|
|
+ tty->driver_data = NULL;
|
|
|
+ }
|
|
|
+ mutex_unlock(&open_mutex);
|
|
|
return;
|
|
|
+ }
|
|
|
acm_port_down(acm, 0);
|
|
|
tty_port_close_end(&acm->port, tty);
|
|
|
- mutex_lock(&open_mutex);
|
|
|
tty_port_tty_set(&acm->port, NULL);
|
|
|
- if (!acm->dev)
|
|
|
- acm_tty_unregister(acm);
|
|
|
- mutex_unlock(&open_mutex);
|
|
|
}
|
|
|
|
|
|
static int acm_tty_write(struct tty_struct *tty,
|