serdev: ttyport: release tty lock sooner on open
authorJohan Hovold <johan@kernel.org>
Fri, 3 Nov 2017 14:30:57 +0000 (15:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2017 15:03:35 +0000 (16:03 +0100)
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.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serdev/serdev-ttyport.c

index ce7ad0acee7aa784772c77339130a3d6289641cd..f76a8e044e4ef3b10e121b56de32726b3856926a 100644 (file)
@@ -104,6 +104,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 |
@@ -117,7 +119,6 @@ static int ttyport_open(struct serdev_controller *ctrl)
 
        set_bit(SERPORT_ACTIVE, &serport->flags);
 
-       tty_unlock(serport->tty);
        return 0;
 
 err_close: