public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Andrew Morton <akpm@osdl.org>
Cc: <linux-kernel@vger.kernel.org>, <support@moxa.com.tw>
Subject: [PATCH 2/3] Char: mxser_new, reverse if-else-paths patch
Date: Mon, 9 Oct 2006 18:00:00 +0200	[thread overview]
Message-ID: <3244545353454@muni.cz> (raw)

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>

---
commit 9c1c1abbe9e875e258bb238b74077d002414c950
tree 4a734348f557a63cea50b061d9aa5b3d4d13d06c
parent e48623373bf13133bf9b76e54bc64f3ab5b46517
author Jiri Slaby <jirislaby@gmail.com> Mon, 09 Oct 2006 14:57:03 +0200
committer Jiri Slaby <xslaby@anemoi.localdomain> Mon, 09 Oct 2006 14:57:03 +0200

 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 28c41a6..08ad269 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -1218,12 +1218,7 @@ static int mxser_write_room(struct tty_s
 static int mxser_chars_in_buffer(struct tty_struct *tty)
 {
 	struct mxser_port *info = tty->driver_data;
-	int len = info->xmit_cnt;
-
-	if (!(inb(info->ioaddr + UART_LSR) & UART_LSR_THRE))
-		len++;
-
-	return len;
+	return info->xmit_cnt;
 }
 
 static void mxser_flush_buffer(struct tty_struct *tty)
@@ -1953,7 +1948,7 @@ static void mxser_stoprx(struct tty_stru
 		if (info->board->chip_flag) {
 			info->IER &= ~MOXA_MUST_RECV_ISR;
 			outb(info->IER, info->ioaddr + UART_IER);
-		} else if (!(info->flags & ASYNC_CLOSING)) {
+		} else {
 			info->x_char = STOP_CHAR(tty);
 			outb(0, info->ioaddr + UART_IER);
 			info->IER |= UART_IER_THRI;
@@ -1990,7 +1985,7 @@ static void mxser_unthrottle(struct tty_
 			if (info->board->chip_flag) {
 				info->IER |= MOXA_MUST_RECV_ISR;
 				outb(info->IER, info->ioaddr + UART_IER);
-			} else if (!(info->flags & ASYNC_CLOSING)) {
+			} else {
 				info->x_char = START_CHAR(tty);
 				outb(0, info->ioaddr + UART_IER);
 				info->IER |= UART_IER_THRI;
@@ -2265,10 +2260,8 @@ static void mxser_receive_chars(struct m
 					flag = TTY_OVERRUN;
 /* added by casper 1/11/2000 */
 					port->icount.overrun++;
-				} else
-					flags = TTY_BREAK;
-			} else
-				flags = 0;
+				}
+			}
 			tty_insert_flip_char(tty, ch, flag);
 			cnt++;
 			if (cnt >= recv_room) {
@@ -2324,14 +2317,8 @@ static void mxser_transmit_chars(struct 
 	if (port->xmit_buf == 0)
 		goto unlock;
 
-	if (port->xmit_cnt == 0) {
-		if (port->xmit_cnt < WAKEUP_CHARS) { /* XXX what's this for?? */
-			set_bit(MXSER_EVENT_TXLOW, &port->event);
-			schedule_work(&port->tqueue);
-		}
-		goto unlock;
-	}
-	if (port->tty->stopped || (port->tty->hw_stopped &&
+	if ((port->xmit_cnt <= 0) || port->tty->stopped ||
+			(port->tty->hw_stopped &&
 			(port->type != PORT_16550A) &&
 			(!port->board->chip_flag))) {
 		port->IER &= ~UART_IER_THRI;

                 reply	other threads:[~2006-10-09 16:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3244545353454@muni.cz \
    --to=jirislaby@gmail.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=support@moxa.com.tw \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox