From: Johan Hovold Date: Thu, 7 Mar 2013 14:55:48 +0000 (+0100) Subject: TTY: clean up port shutdown X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=8bde9658a0e6a7098dcda1ce6ea6b278029644b4;p=deliverable%2Flinux.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 7f38eeaafac3..2aea2f91e271 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); }