summaryrefslogtreecommitdiffstats
path: root/drivers/tty/mxser.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-09 03:05:05 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-09 03:05:05 -0400
commit9424e8b1fedbaff34df187fdb87f9a9cba2d0ff2 (patch)
tree7a595ccc67ae0cd9a414383ff2f6ede291c7dc18 /drivers/tty/mxser.c
parentbccf1da3546cc7aeefadc63cd4356ab8dc04c1e3 (diff)
parent8a5776a5f49812d29fe4b2d0a2d71675c3facf3f (diff)
Merge 4.14-rc4 into tty-next
We want the tty/serial fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/mxser.c')
-rw-r--r--drivers/tty/mxser.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 7f7968475736..2497be8a2190 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -246,11 +246,11 @@ struct mxser_port {
246 unsigned char err_shadow; 246 unsigned char err_shadow;
247 247
248 struct async_icount icount; /* kernel counters for 4 input interrupts */ 248 struct async_icount icount; /* kernel counters for 4 input interrupts */
249 int timeout; 249 unsigned int timeout;
250 250
251 int read_status_mask; 251 int read_status_mask;
252 int ignore_status_mask; 252 int ignore_status_mask;
253 int xmit_fifo_size; 253 unsigned int xmit_fifo_size;
254 int xmit_head; 254 int xmit_head;
255 int xmit_tail; 255 int xmit_tail;
256 int xmit_cnt; 256 int xmit_cnt;
@@ -572,8 +572,9 @@ static void mxser_dtr_rts(struct tty_port *port, int on)
572static int mxser_set_baud(struct tty_struct *tty, long newspd) 572static int mxser_set_baud(struct tty_struct *tty, long newspd)
573{ 573{
574 struct mxser_port *info = tty->driver_data; 574 struct mxser_port *info = tty->driver_data;
575 int quot = 0, baud; 575 unsigned int quot = 0, baud;
576 unsigned char cval; 576 unsigned char cval;
577 u64 timeout;
577 578
578 if (!info->ioaddr) 579 if (!info->ioaddr)
579 return -1; 580 return -1;
@@ -594,8 +595,13 @@ static int mxser_set_baud(struct tty_struct *tty, long newspd)
594 quot = 0; 595 quot = 0;
595 } 596 }
596 597
597 info->timeout = ((info->xmit_fifo_size * HZ * 10 * quot) / info->baud_base); 598 /*
598 info->timeout += HZ / 50; /* Add .02 seconds of slop */ 599 * worst case (128 * 1000 * 10 * 18432) needs 35 bits, so divide in the
600 * u64 domain
601 */
602 timeout = (u64)info->xmit_fifo_size * HZ * 10 * quot;
603 do_div(timeout, info->baud_base);
604 info->timeout = timeout + HZ / 50; /* Add .02 seconds of slop */
599 605
600 if (quot) { 606 if (quot) {
601 info->MCR |= UART_MCR_DTR; 607 info->MCR |= UART_MCR_DTR;