X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=drivers%2Fusb%2Fserial%2Fch341.c;h=ba28fdc9ccd2f589a2ec5038616dc91795fd9757;hb=26ab705396b65a469233a8327ecb51b8aebb6be0;hp=6b252ceb39a828b69b29b78b2dfdfdf572a88bbd;hpb=ebf8889bd1fe3615991ff4494635d237280652a2;p=karo-tx-linux.git diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 6b252ceb39a8..ba28fdc9ccd2 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -130,7 +130,7 @@ static int ch341_get_status(struct usb_device *dev) return -ENOMEM; r = ch341_control_in(dev, 0x95, 0x0706, 0, buffer, size); - if ( r < 0) + if (r < 0) goto out; /* Not having the datasheet for the CH341, we ignore the bytes returned @@ -272,9 +272,6 @@ static void ch341_set_termios(struct usb_serial_port *port, dbg("ch341_set_termios()"); - if (!tty || !tty->termios) - return; - baud_rate = tty_get_baud_rate(tty); switch (baud_rate) { @@ -299,6 +296,11 @@ static void ch341_set_termios(struct usb_serial_port *port, * (cflag & PARENB) : parity {NONE, EVEN, ODD} * (cflag & CSTOPB) : stop bits [1, 2] */ + + /* Copy back the old hardware settings */ + tty_termios_copy_hw(tty->termios, old_termios); + /* And re-encode with the new baud */ + tty_encode_baud_rate(tty, baud_rate, baud_rate); } static struct usb_driver ch341_driver = { @@ -316,9 +318,6 @@ static struct usb_serial_driver ch341_device = { }, .id_table = id_table, .usb_driver = &ch341_driver, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = 1, - .num_bulk_out = 1, .num_ports = 1, .open = ch341_open, .set_termios = ch341_set_termios,