USB: ch341: set tty baud speed according to tty struct
authorNicolas PLANEL <nicolas.planel@enovance.com>
Sun, 1 Mar 2015 18:47:22 +0000 (13:47 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 16 Mar 2017 02:18:40 +0000 (02:18 +0000)
commit79ef969f1b5d75226a53df6a2a3edf5c5cda9794
tree4f7040b99f16f087c721be95c5e072dfe8e71859
parentcefd595f97fc8ac4bc5401aeb616e49a2a9fe288
USB: ch341: set tty baud speed according to tty struct

commit aa91def41a7bb1fd65492934ce6bea19202b6080 upstream.

The ch341_set_baudrate() function initialize the device baud speed
according to the value on priv->baud_rate. By default the ch341_open() set
it to a hardcoded value (DEFAULT_BAUD_RATE 9600). Unfortunately, the
tty_struct is not initialized with the same default value. (usually 56700)

This means that the tty_struct and the device baud rate generator are not
synchronized after opening the port.

Fixup is done by calling ch341_set_termios() if tty exist.
Remove unnecessary variable priv->baud_rate setup as it's already done by
ch341_port_probe().
Remove unnecessary call to ch341_set_{handshake,baudrate}() in
ch341_open() as there already called in ch341_configure() and
ch341_set_termios()

Signed-off-by: Nicolas PLANEL <nicolas.planel@enovance.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/usb/serial/ch341.c