aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/tty_ioctl.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index 745d552620bf..0def089cc1f2 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -228,7 +228,8 @@ EXPORT_SYMBOL(tty_termios_input_baud_rate);
228 * and will all go away once this is done. 228 * and will all go away once this is done.
229 */ 229 */
230 230
231void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud) 231void tty_termios_encode_baud_rate(struct ktermios *termios,
232 speed_t ibaud, speed_t obaud)
232{ 233{
233 int i = 0; 234 int i = 0;
234 int ifound = -1, ofound = -1; 235 int ifound = -1, ofound = -1;
@@ -263,11 +264,15 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed
263 */ 264 */
264 265
265 do { 266 do {
266 if (obaud - oclose >= baud_table[i] && obaud + oclose <= baud_table[i]) { 267 if (obaud - oclose <= baud_table[i] &&
268 obaud + oclose >= baud_table[i]) {
267 termios->c_cflag |= baud_bits[i]; 269 termios->c_cflag |= baud_bits[i];
268 ofound = i; 270 ofound = i;
269 } 271 }
270 if (ibaud - iclose >= baud_table[i] && ibaud + iclose <= baud_table[i]) { 272 if (ibaud - iclose <= baud_table[i] &&
273 ibaud + iclose >= baud_table[i]) {
274 /* For the case input == output don't set IBAUD bits
275 if the user didn't do so */
271 if (ofound == i && !ibinput) 276 if (ofound == i && !ibinput)
272 ifound = i; 277 ifound = i;
273#ifdef IBSHIFT 278#ifdef IBSHIFT