Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bde9658 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

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: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b12d8dc2
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -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);
}