TTY: wake up processes last at hangup
authorJohan Hovold <jhovold@gmail.com>
Thu, 7 Mar 2013 14:55:49 +0000 (15:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Mar 2013 23:27:53 +0000 (16:27 -0700)
Move wake up of processes on blocked-open and modem-status wait queues
to after port shutdown at hangup.

This way the woken up processes can use the ASYNC_INITIALIZED flag to
detect port shutdown.

Note that this is the order currently used by serial-core.

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

index 2aea2f91e271b045bb42b02ed588ee7761f26fcd..73bc1d989d322fb166359ae1a5dea6044a7aa494 100644 (file)
@@ -231,9 +231,9 @@ void tty_port_hangup(struct tty_port *port)
        }
        port->tty = NULL;
        spin_unlock_irqrestore(&port->lock, flags);
+       tty_port_shutdown(port);
        wake_up_interruptible(&port->open_wait);
        wake_up_interruptible(&port->delta_msr_wait);
-       tty_port_shutdown(port);
 }
 EXPORT_SYMBOL(tty_port_hangup);