Skip to content

Commit

Permalink
USB: serial: ch341: fix line settings after reset-resume
Browse files Browse the repository at this point in the history
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: ba781bd ("USB: serial: ch341: add support for parity, frame
length, stop bits")
Signed-off-by: Johan Hovold <johan@kernel.org>
  • Loading branch information
Johan Hovold committed Jan 9, 2017
1 parent ce5e292 commit 3cca862
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/usb/serial/ch341.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 3cca862

Please sign in to comment.