diff options
author | Nicolas PLANEL <nicolas.planel@enovance.com> | 2015-03-01 13:47:22 -0500 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2015-03-02 03:31:02 -0500 |
commit | aa91def41a7bb1fd65492934ce6bea19202b6080 (patch) | |
tree | 94898862f9900edc9ce2a2bbc0490059d4408e55 /drivers/usb/serial/ch341.c | |
parent | 675af70856d7cc026be8b6ea7a8b9db10b8b38a1 (diff) |
USB: ch341: set tty baud speed according to tty struct
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>
Diffstat (limited to 'drivers/usb/serial/ch341.c')
-rw-r--r-- | drivers/usb/serial/ch341.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 2d72aa3564a3..ede4f5fcfadd 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -84,6 +84,10 @@ struct ch341_private { | |||
84 | u8 line_status; /* active status of modem control inputs */ | 84 | u8 line_status; /* active status of modem control inputs */ |
85 | }; | 85 | }; |
86 | 86 | ||
87 | static void ch341_set_termios(struct tty_struct *tty, | ||
88 | struct usb_serial_port *port, | ||
89 | struct ktermios *old_termios); | ||
90 | |||
87 | static int ch341_control_out(struct usb_device *dev, u8 request, | 91 | static int ch341_control_out(struct usb_device *dev, u8 request, |
88 | u16 value, u16 index) | 92 | u16 value, u16 index) |
89 | { | 93 | { |
@@ -309,19 +313,12 @@ static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
309 | struct ch341_private *priv = usb_get_serial_port_data(port); | 313 | struct ch341_private *priv = usb_get_serial_port_data(port); |
310 | int r; | 314 | int r; |
311 | 315 | ||
312 | priv->baud_rate = DEFAULT_BAUD_RATE; | ||
313 | |||
314 | r = ch341_configure(serial->dev, priv); | 316 | r = ch341_configure(serial->dev, priv); |
315 | if (r) | 317 | if (r) |
316 | goto out; | 318 | goto out; |
317 | 319 | ||
318 | r = ch341_set_handshake(serial->dev, priv->line_control); | 320 | if (tty) |
319 | if (r) | 321 | ch341_set_termios(tty, port, NULL); |
320 | goto out; | ||
321 | |||
322 | r = ch341_set_baudrate(serial->dev, priv); | ||
323 | if (r) | ||
324 | goto out; | ||
325 | 322 | ||
326 | dev_dbg(&port->dev, "%s - submitting interrupt urb\n", __func__); | 323 | dev_dbg(&port->dev, "%s - submitting interrupt urb\n", __func__); |
327 | r = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 324 | r = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |