Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=75e8b71d559632dd70c9799ea8b5c133a2ddcea9 Commit: 75e8b71d559632dd70c9799ea8b5c133a2ddcea9 Parent: 77bf2bab91e4e7df361963451c7b9a803516438c Author: Maciej W. Rozycki <[EMAIL PROTECTED]> AuthorDate: Thu Oct 18 03:04:35 2007 -0700 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Thu Oct 18 14:37:17 2007 -0700
tty_ioctl: fix the baud_table check in encode_baud_rate The tty_termios_encode_baud_rate() function as defined by tty_ioctl.c has a problem with the baud_table within. The comparison operators are reversed and as a result this table's entries never match and BOTHER is always used. Signed-off-by: Maciej W. Rozycki <[EMAIL PROTECTED]> Acked-by: Alan Cox <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/char/tty_ioctl.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index 745d552..0def089 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c @@ -228,7 +228,8 @@ EXPORT_SYMBOL(tty_termios_input_baud_rate); * and will all go away once this is done. */ -void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud) +void tty_termios_encode_baud_rate(struct ktermios *termios, + speed_t ibaud, speed_t obaud) { int i = 0; int ifound = -1, ofound = -1; @@ -263,11 +264,15 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed */ do { - if (obaud - oclose >= baud_table[i] && obaud + oclose <= baud_table[i]) { + if (obaud - oclose <= baud_table[i] && + obaud + oclose >= baud_table[i]) { termios->c_cflag |= baud_bits[i]; ofound = i; } - if (ibaud - iclose >= baud_table[i] && ibaud + iclose <= baud_table[i]) { + if (ibaud - iclose <= baud_table[i] && + ibaud + iclose >= baud_table[i]) { + /* For the case input == output don't set IBAUD bits + if the user didn't do so */ if (ofound == i && !ibinput) ifound = i; #ifdef IBSHIFT - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html