TTY: clean up port shutdown
authorJohan Hovold <jhovold@gmail.com>
Thu, 7 Mar 2013 14:55:48 +0000 (15:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Mar 2013 23:27:53 +0000 (16:27 -0700)
Untangle port-shutdown logic and make sure the initialised flag is
always cleared for non-console ports.

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

index 7f38eeaafac3d1036c2307d99fb25d265a253503..2aea2f91e271b045bb42b02ed588ee7761f26fcd 100644 (file)
@@ -199,9 +199,14 @@ EXPORT_SYMBOL(tty_port_tty_set);
 static void tty_port_shutdown(struct tty_port *port)
 {
        mutex_lock(&port->mutex);
-       if (port->ops->shutdown && !port->console &&
-               test_and_clear_bit(ASYNCB_INITIALIZED, &port->flags))
+       if (port->console)
+               goto out;
+
+       if (test_and_clear_bit(ASYNCB_INITIALIZED, &port->flags)) {
+               if (port->ops->shutdown)
                        port->ops->shutdown(port);
+       }
+out:
        mutex_unlock(&port->mutex);
 }