aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/mxser_new.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/mxser_new.c')
-rw-r--r--drivers/char/mxser_new.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c
index a4358acb1b2b..f74734b3407b 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -452,18 +452,17 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp,
452static int mxser_set_baud(struct mxser_port *info, long newspd) 452static int mxser_set_baud(struct mxser_port *info, long newspd)
453{ 453{
454 unsigned int i; 454 unsigned int i;
455 int quot = 0; 455 int quot = 0, baud;
456 unsigned char cval; 456 unsigned char cval;
457 int ret = 0;
458 457
459 if (!info->tty || !info->tty->termios) 458 if (!info->tty || !info->tty->termios)
460 return ret; 459 return -1;
461 460
462 if (!(info->ioaddr)) 461 if (!(info->ioaddr))
463 return ret; 462 return -1;
464 463
465 if (newspd > info->max_baud) 464 if (newspd > info->max_baud)
466 return 0; 465 return -1;
467 466
468 info->realbaud = newspd; 467 info->realbaud = newspd;
469 for (i = 0; i < BAUD_TABLE_NO; i++) 468 for (i = 0; i < BAUD_TABLE_NO; i++)
@@ -476,10 +475,13 @@ static int mxser_set_baud(struct mxser_port *info, long newspd)
476 } else { 475 } else {
477 if (newspd == 134) { 476 if (newspd == 134) {
478 quot = (2 * info->baud_base / 269); 477 quot = (2 * info->baud_base / 269);
478 tty_encode_baud_rate(info->tty, 134, 134);
479 } else if (newspd) { 479 } else if (newspd) {
480 quot = info->baud_base / newspd; 480 quot = info->baud_base / newspd;
481 if (quot == 0) 481 if (quot == 0)
482 quot = 1; 482 quot = 1;
483 baud = info->baud_base/quot;
484 tty_encode_baud_rate(info->tty, baud, baud);
483 } else { 485 } else {
484 quot = 0; 486 quot = 0;
485 } 487 }
@@ -494,7 +496,7 @@ static int mxser_set_baud(struct mxser_port *info, long newspd)
494 } else { 496 } else {
495 info->MCR &= ~UART_MCR_DTR; 497 info->MCR &= ~UART_MCR_DTR;
496 outb(info->MCR, info->ioaddr + UART_MCR); 498 outb(info->MCR, info->ioaddr + UART_MCR);
497 return ret; 499 return 0;
498 } 500 }
499 501
500 cval = inb(info->ioaddr + UART_LCR); 502 cval = inb(info->ioaddr + UART_LCR);
@@ -518,7 +520,7 @@ static int mxser_set_baud(struct mxser_port *info, long newspd)
518 } else 520 } else
519 SET_MOXA_MUST_ENUM_VALUE(info->ioaddr, 0); 521 SET_MOXA_MUST_ENUM_VALUE(info->ioaddr, 0);
520 522
521 return ret; 523 return 0;
522} 524}
523 525
524/* 526/*