Commit b59dc14b authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

serdev: ttyport: enforce tty-driver open() requirement


[ Upstream commit dee7d0f3 ]

The tty-driver open routine is mandatory, but the serdev
tty-port-controller implementation did not treat it as such and would
instead fall back to calling tty_port_open() directly.
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Acked-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 669ff2a9
......@@ -120,10 +120,10 @@ static int ttyport_open(struct serdev_controller *ctrl)
return PTR_ERR(tty);
serport->tty = tty;
if (tty->ops->open)
tty->ops->open(serport->tty, NULL);
else
tty_port_open(serport->port, tty, NULL);
if (!tty->ops->open)
goto err_unlock;
tty->ops->open(serport->tty, NULL);
/* Bring the UART into a known 8 bits no parity hw fc state */
ktermios = tty->termios;
......@@ -140,6 +140,12 @@ static int ttyport_open(struct serdev_controller *ctrl)
tty_unlock(serport->tty);
return 0;
err_unlock:
tty_unlock(tty);
tty_release_struct(tty, serport->tty_idx);
return -ENODEV;
}
static void ttyport_close(struct serdev_controller *ctrl)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment