Commit 925e9c1c authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds
Browse files

[PATCH] Char: mxser_new, reverse if-else-paths patch



This patch was intorduced in mxser to 1.9.1 conversion, but causes endless
sleep in tcdrain userspace call.

Thanks to Sergei Organov <osv@javad.com> for testing and pointing this out.
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent cd7ed64e
...@@ -1218,12 +1218,7 @@ static int mxser_write_room(struct tty_struct *tty) ...@@ -1218,12 +1218,7 @@ static int mxser_write_room(struct tty_struct *tty)
static int mxser_chars_in_buffer(struct tty_struct *tty) static int mxser_chars_in_buffer(struct tty_struct *tty)
{ {
struct mxser_port *info = tty->driver_data; struct mxser_port *info = tty->driver_data;
int len = info->xmit_cnt; return info->xmit_cnt;
if (!(inb(info->ioaddr + UART_LSR) & UART_LSR_THRE))
len++;
return len;
} }
static void mxser_flush_buffer(struct tty_struct *tty) static void mxser_flush_buffer(struct tty_struct *tty)
...@@ -1953,7 +1948,7 @@ static void mxser_stoprx(struct tty_struct *tty) ...@@ -1953,7 +1948,7 @@ static void mxser_stoprx(struct tty_struct *tty)
if (info->board->chip_flag) { if (info->board->chip_flag) {
info->IER &= ~MOXA_MUST_RECV_ISR; info->IER &= ~MOXA_MUST_RECV_ISR;
outb(info->IER, info->ioaddr + UART_IER); outb(info->IER, info->ioaddr + UART_IER);
} else if (!(info->flags & ASYNC_CLOSING)) { } else {
info->x_char = STOP_CHAR(tty); info->x_char = STOP_CHAR(tty);
outb(0, info->ioaddr + UART_IER); outb(0, info->ioaddr + UART_IER);
info->IER |= UART_IER_THRI; info->IER |= UART_IER_THRI;
...@@ -1990,7 +1985,7 @@ static void mxser_unthrottle(struct tty_struct *tty) ...@@ -1990,7 +1985,7 @@ static void mxser_unthrottle(struct tty_struct *tty)
if (info->board->chip_flag) { if (info->board->chip_flag) {
info->IER |= MOXA_MUST_RECV_ISR; info->IER |= MOXA_MUST_RECV_ISR;
outb(info->IER, info->ioaddr + UART_IER); outb(info->IER, info->ioaddr + UART_IER);
} else if (!(info->flags & ASYNC_CLOSING)) { } else {
info->x_char = START_CHAR(tty); info->x_char = START_CHAR(tty);
outb(0, info->ioaddr + UART_IER); outb(0, info->ioaddr + UART_IER);
info->IER |= UART_IER_THRI; info->IER |= UART_IER_THRI;
...@@ -2265,10 +2260,8 @@ static void mxser_receive_chars(struct mxser_port *port, int *status) ...@@ -2265,10 +2260,8 @@ static void mxser_receive_chars(struct mxser_port *port, int *status)
flag = TTY_OVERRUN; flag = TTY_OVERRUN;
/* added by casper 1/11/2000 */ /* added by casper 1/11/2000 */
port->icount.overrun++; port->icount.overrun++;
} else }
flags = TTY_BREAK; }
} else
flags = 0;
tty_insert_flip_char(tty, ch, flag); tty_insert_flip_char(tty, ch, flag);
cnt++; cnt++;
if (cnt >= recv_room) { if (cnt >= recv_room) {
...@@ -2324,14 +2317,8 @@ static void mxser_transmit_chars(struct mxser_port *port) ...@@ -2324,14 +2317,8 @@ static void mxser_transmit_chars(struct mxser_port *port)
if (port->xmit_buf == 0) if (port->xmit_buf == 0)
goto unlock; goto unlock;
if (port->xmit_cnt == 0) { if ((port->xmit_cnt <= 0) || port->tty->stopped ||
if (port->xmit_cnt < WAKEUP_CHARS) { /* XXX what's this for?? */ (port->tty->hw_stopped &&
set_bit(MXSER_EVENT_TXLOW, &port->event);
schedule_work(&port->tqueue);
}
goto unlock;
}
if (port->tty->stopped || (port->tty->hw_stopped &&
(port->type != PORT_16550A) && (port->type != PORT_16550A) &&
(!port->board->chip_flag))) { (!port->board->chip_flag))) {
port->IER &= ~UART_IER_THRI; port->IER &= ~UART_IER_THRI;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment