Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 75310
b: refs/heads/master
c: bf5e583
h: refs/heads/master
v: v3
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Jan 9, 2008
1 parent 7fa47a1 commit a032241
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cf0594625083111ae522496dc1c256f7476939c2
refs/heads/master: bf5e5834bffc62b50cd4a201804506eb11ef1af8
19 changes: 19 additions & 0 deletions trunk/drivers/char/tty_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,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
Expand Down
7 changes: 7 additions & 0 deletions trunk/drivers/usb/serial/pl2303.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/tty.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
extern void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud);
extern void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud);
extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);

extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
extern void tty_ldisc_deref(struct tty_ldisc *);
Expand Down

0 comments on commit a032241

Please sign in to comment.