aboutsummaryrefslogtreecommitdiff
path: root/drivers/tty/tty_port.c
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-03-07 15:55:48 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-18 16:27:53 -0700
commit8bde9658a0e6a7098dcda1ce6ea6b278029644b4 (patch)
treec145dc5808d6c93809bd07dd083191165d14da4c /drivers/tty/tty_port.c
parentb12d8dc2dbe2d2d1d6eec314d586b1eed75756dc (diff)
TTY: clean up port shutdown
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>
Diffstat (limited to 'drivers/tty/tty_port.c')
-rw-r--r--drivers/tty/tty_port.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 7f38eeaafac..2aea2f91e27 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -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);
}