diff mbox series

[SRU,B,01/10] serdev: ttyport: release tty lock sooner on open

Message ID 20200221064127.16848-2-shrirang.bagul@canonical.com
State New
Headers show
Series Support Intel Atom (Baytrail-I) HS-UART serdev slaves over tty | expand

Commit Message

Shrirang Bagul Feb. 21, 2020, 6:41 a.m. UTC
From: Johan Hovold <johan at kernel.org>

BugLink: https://bugs.launchpad.net/bugs/1864147

Release the tty lock once tty-driver open returns to make it clear that
it does not protect neither tty->termios or the serport flags.

linux-oem buglink: http://bugs.launchpad.net/bugs/1769610

Signed-off-by: Johan Hovold <johan at kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
(cherry picked from commit 51899a63b42ee01df676b0624df4e81a517c3571)
Signed-off-by: Shrirang Bagul <shrirang.bagul at canonical.com>
Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
(cherry picked from commit 03cd12a5bd08d48898e0293fa86bef5bae515da2)
(source tag: Ubuntu-oem-4.15.0-1073.83)
Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>
---
 drivers/tty/serdev/serdev-ttyport.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/tty/serdev/serdev-ttyport.c b/drivers/tty/serdev/serdev-ttyport.c
index 247788a16f0b..f892fbe08208 100644
--- a/drivers/tty/serdev/serdev-ttyport.c
+++ b/drivers/tty/serdev/serdev-ttyport.c
@@ -122,6 +122,8 @@  static int ttyport_open(struct serdev_controller *ctrl)
 	if (ret)
 		goto err_close;
 
+	tty_unlock(serport->tty);
+
 	/* Bring the UART into a known 8 bits no parity hw fc state */
 	ktermios = tty->termios;
 	ktermios.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP |
@@ -135,7 +137,6 @@  static int ttyport_open(struct serdev_controller *ctrl)
 
 	set_bit(SERPORT_ACTIVE, &serport->flags);
 
-	tty_unlock(serport->tty);
 	return 0;
 
 err_close: