USB: serial: wake up MSR-wait queue on disconnect
authorJohan Hovold <jhovold@gmail.com>
Thu, 21 Mar 2013 11:36:53 +0000 (12:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Mar 2013 20:50:51 +0000 (13:50 -0700)
Make sure processes waiting for modem-status changes are woken up at
disconnect.

This is needed for custom subdriver TIOCMIWAIT-implementations which do
not yet handle hangup.

Even though processes on the tty-port wait queue are woken up at hangup
the wake-up call in usb-serial disconnect is still needed if a woken-up
process may go back to sleep (e.g. due to an incomplete
TIOCMIWAIT-implementation). If a disconnect occurs after a hangup, any
process waiting for changes will not be woken up a second time by the
tty-layer as the port will then have been disassociated from the tty.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/usb-serial.c

index ada400d6594b2d5a96578621ad53704a4bc7946a..4568816207276718e92ab12c6de40e57e9d94558 100644 (file)
@@ -1093,6 +1093,7 @@ static void usb_serial_disconnect(struct usb_interface *interface)
                                tty_kref_put(tty);
                        }
                        usb_serial_port_poison_urbs(port);
+                       wake_up_interruptible(&port->port.delta_msr_wait);
                        cancel_work_sync(&port->work);
                        if (device_is_registered(&port->dev))
                                device_del(&port->dev);