aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/tty_ioctl.c19
-rw-r--r--drivers/usb/serial/pl2303.c7
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index e02d59245a1..d4b6d64e858 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -365,6 +365,25 @@ void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old)
EXPORT_SYMBOL(tty_termios_copy_hw);
/**
+ * tty_termios_hw_change - check for setting change
+ * @a: termios
+ * @b: termios to compare
+ *
+ * Check if any of the bits that affect a dumb device have changed
+ * between the two termios structures, or a speed change is needed.
+ */
+
+int tty_termios_hw_change(struct ktermios *a, struct ktermios *b)
+{
+ if (a->c_ispeed != b->c_ispeed || a->c_ospeed != b->c_ospeed)
+ return 1;
+ if ((a->c_cflag ^ b->c_cflag) & ~(HUPCL | CREAD | CLOCAL))
+ return 1;
+ return 0;
+}
+EXPORT_SYMBOL(tty_termios_hw_change);
+
+/**
* change_termios - update termios values
* @tty: tty to update
* @new_termios: desired new value
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index cf8add91de0..0da1df9c79b 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -483,6 +483,13 @@ static void pl2303_set_termios(struct usb_serial_port *port,
}
spin_unlock_irqrestore(&priv->lock, flags);
+ /* The PL2303 is reported to lose bytes if you change
+ serial settings even to the same values as before. Thus
+ we actually need to filter in this specific case */
+
+ if (!tty_termios_hw_change(port->tty->termios, old_termios))
+ return;
+
cflag = port->tty->termios->c_cflag;
buf = kzalloc(7, GFP_KERNEL);