diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2006-12-08 05:38:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:28:54 -0500 |
commit | 925e9c1c08750096ddb4634f5d06b5451e4a92a8 (patch) | |
tree | c4617708dc076892dc52ec501aa7643ccdf37325 /drivers/char/mxser_new.c | |
parent | cd7ed64e1508d3275c20d072bf9037028ec34f56 (diff) |
[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: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/mxser_new.c')
-rw-r--r-- | drivers/char/mxser_new.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c index 82cb420b4d68..285104d379cb 100644 --- a/drivers/char/mxser_new.c +++ b/drivers/char/mxser_new.c | |||
@@ -1218,12 +1218,7 @@ static int mxser_write_room(struct tty_struct *tty) | |||
1218 | static int mxser_chars_in_buffer(struct tty_struct *tty) | 1218 | static int mxser_chars_in_buffer(struct tty_struct *tty) |
1219 | { | 1219 | { |
1220 | struct mxser_port *info = tty->driver_data; | 1220 | struct mxser_port *info = tty->driver_data; |
1221 | int len = info->xmit_cnt; | 1221 | return info->xmit_cnt; |
1222 | |||
1223 | if (!(inb(info->ioaddr + UART_LSR) & UART_LSR_THRE)) | ||
1224 | len++; | ||
1225 | |||
1226 | return len; | ||
1227 | } | 1222 | } |
1228 | 1223 | ||
1229 | static void mxser_flush_buffer(struct tty_struct *tty) | 1224 | static void mxser_flush_buffer(struct tty_struct *tty) |
@@ -1953,7 +1948,7 @@ static void mxser_stoprx(struct tty_struct *tty) | |||
1953 | if (info->board->chip_flag) { | 1948 | if (info->board->chip_flag) { |
1954 | info->IER &= ~MOXA_MUST_RECV_ISR; | 1949 | info->IER &= ~MOXA_MUST_RECV_ISR; |
1955 | outb(info->IER, info->ioaddr + UART_IER); | 1950 | outb(info->IER, info->ioaddr + UART_IER); |
1956 | } else if (!(info->flags & ASYNC_CLOSING)) { | 1951 | } else { |
1957 | info->x_char = STOP_CHAR(tty); | 1952 | info->x_char = STOP_CHAR(tty); |
1958 | outb(0, info->ioaddr + UART_IER); | 1953 | outb(0, info->ioaddr + UART_IER); |
1959 | info->IER |= UART_IER_THRI; | 1954 | info->IER |= UART_IER_THRI; |
@@ -1990,7 +1985,7 @@ static void mxser_unthrottle(struct tty_struct *tty) | |||
1990 | if (info->board->chip_flag) { | 1985 | if (info->board->chip_flag) { |
1991 | info->IER |= MOXA_MUST_RECV_ISR; | 1986 | info->IER |= MOXA_MUST_RECV_ISR; |
1992 | outb(info->IER, info->ioaddr + UART_IER); | 1987 | outb(info->IER, info->ioaddr + UART_IER); |
1993 | } else if (!(info->flags & ASYNC_CLOSING)) { | 1988 | } else { |
1994 | info->x_char = START_CHAR(tty); | 1989 | info->x_char = START_CHAR(tty); |
1995 | outb(0, info->ioaddr + UART_IER); | 1990 | outb(0, info->ioaddr + UART_IER); |
1996 | info->IER |= UART_IER_THRI; | 1991 | info->IER |= UART_IER_THRI; |
@@ -2265,10 +2260,8 @@ static void mxser_receive_chars(struct mxser_port *port, int *status) | |||
2265 | flag = TTY_OVERRUN; | 2260 | flag = TTY_OVERRUN; |
2266 | /* added by casper 1/11/2000 */ | 2261 | /* added by casper 1/11/2000 */ |
2267 | port->icount.overrun++; | 2262 | port->icount.overrun++; |
2268 | } else | 2263 | } |
2269 | flags = TTY_BREAK; | 2264 | } |
2270 | } else | ||
2271 | flags = 0; | ||
2272 | tty_insert_flip_char(tty, ch, flag); | 2265 | tty_insert_flip_char(tty, ch, flag); |
2273 | cnt++; | 2266 | cnt++; |
2274 | if (cnt >= recv_room) { | 2267 | if (cnt >= recv_room) { |
@@ -2324,14 +2317,8 @@ static void mxser_transmit_chars(struct mxser_port *port) | |||
2324 | if (port->xmit_buf == 0) | 2317 | if (port->xmit_buf == 0) |
2325 | goto unlock; | 2318 | goto unlock; |
2326 | 2319 | ||
2327 | if (port->xmit_cnt == 0) { | 2320 | if ((port->xmit_cnt <= 0) || port->tty->stopped || |
2328 | if (port->xmit_cnt < WAKEUP_CHARS) { /* XXX what's this for?? */ | 2321 | (port->tty->hw_stopped && |
2329 | set_bit(MXSER_EVENT_TXLOW, &port->event); | ||
2330 | schedule_work(&port->tqueue); | ||
2331 | } | ||
2332 | goto unlock; | ||
2333 | } | ||
2334 | if (port->tty->stopped || (port->tty->hw_stopped && | ||
2335 | (port->type != PORT_16550A) && | 2322 | (port->type != PORT_16550A) && |
2336 | (!port->board->chip_flag))) { | 2323 | (!port->board->chip_flag))) { |
2337 | port->IER &= ~UART_IER_THRI; | 2324 | port->IER &= ~UART_IER_THRI; |