summaryrefslogtreecommitdiff
path: root/drivers/usb/serial/ch341.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-01-06 21:15:15 +0300
committerJohan Hovold <johan@kernel.org>2017-01-09 16:55:39 +0300
commit3cca8624b6624e7ffb87dcd8a0a05bef9b50e97b (patch)
tree140e873caf7599ec4fbfe82bc6b083f25e3dd16a /drivers/usb/serial/ch341.c
parentce5e292828117d1b71cbd3edf9e9137cf31acd30 (diff)
downloadlinux-3cca8624b6624e7ffb87dcd8a0a05bef9b50e97b.tar.xz
USB: serial: ch341: fix line settings after reset-resume
A recent change added support for modifying the default line-control settings, but did not make sure that the modified settings were used as part of reconfiguration after a device has been reset during resume. This caused a port that was open before suspend to be unusable until being closed and reopened. Fixes: ba781bdf8662 ("USB: serial: ch341: add support for parity, frame length, stop bits") Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial/ch341.c')
-rw-r--r--drivers/usb/serial/ch341.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index 5343d65f3b52..eabdd05a2147 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -95,6 +95,7 @@ struct ch341_private {
unsigned baud_rate; /* set baud rate */
u8 line_control; /* set line control value RTS/DTR */
u8 line_status; /* active status of modem control inputs */
+ u8 lcr;
};
static void ch341_set_termios(struct tty_struct *tty,
@@ -232,7 +233,7 @@ static int ch341_configure(struct usb_device *dev, struct ch341_private *priv)
if (r < 0)
goto out;
- r = ch341_init_set_baudrate(dev, priv, 0);
+ r = ch341_init_set_baudrate(dev, priv, priv->lcr);
if (r < 0)
goto out;
@@ -397,6 +398,8 @@ static void ch341_set_termios(struct tty_struct *tty,
if (r < 0 && old_termios) {
priv->baud_rate = tty_termios_baud_rate(old_termios);
tty_termios_copy_hw(&tty->termios, old_termios);
+ } else if (r == 0) {
+ priv->lcr = ctrl;
}
}