linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: alan@linux.intel.com, gregkh@suse.de, scottwood@freescale.com,
	galak@kernel.crashing.org
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org
Subject: [PATCH 2/6] serial: clean up parameter passing for 8250 Rx IRQ handling
Date: Sun,  4 Dec 2011 18:42:19 -0500	[thread overview]
Message-ID: <1323042143-25330-3-git-send-email-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <1323042143-25330-1-git-send-email-paul.gortmaker@windriver.com>

The receive_chars() was taking a pointer to a passed in LSR value
in status and knocking off bits as it processed them.  But since
receive_chars isn't returning a value, we can instead pass in
a normal non-pointer value for LSR, and simply return the
residual (unprocessed) LSR once it is done.

The value in this cleanup, is that it clarifies the API of the
receive_chars prior to exporting it to other 8250-like drivers
for shared usage.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/tty/serial/8250.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c
index d97628e..a20d7eb 100644
--- a/drivers/tty/serial/8250.c
+++ b/drivers/tty/serial/8250.c
@@ -1375,11 +1375,16 @@ static void clear_rx_fifo(struct uart_8250_port *up)
 	} while (1);
 }
 
-static void
-receive_chars(struct uart_8250_port *up, unsigned int *status)
+/*
+ * receive_chars: processes according to the passed in LSR
+ * value, and returns the remaining LSR bits not handled
+ * by this Rx routine.
+ */
+static unsigned char
+receive_chars(struct uart_8250_port *up, unsigned char lsr)
 {
 	struct tty_struct *tty = up->port.state->port.tty;
-	unsigned char ch, lsr = *status;
+	unsigned char ch;
 	int max_count = 256;
 	char flag;
 
@@ -1455,7 +1460,7 @@ ignore_char:
 	spin_unlock(&up->port.lock);
 	tty_flip_buffer_push(tty);
 	spin_lock(&up->port.lock);
-	*status = lsr;
+	return lsr;
 }
 
 static void transmit_chars(struct uart_8250_port *up)
@@ -1524,7 +1529,7 @@ static unsigned int check_modem_status(struct uart_8250_port *up)
  */
 static void serial8250_handle_port(struct uart_8250_port *up)
 {
-	unsigned int status;
+	unsigned char status;
 	unsigned long flags;
 
 	spin_lock_irqsave(&up->port.lock, flags);
@@ -1534,7 +1539,7 @@ static void serial8250_handle_port(struct uart_8250_port *up)
 	DEBUG_INTR("status = %x...", status);
 
 	if (status & (UART_LSR_DR | UART_LSR_BI))
-		receive_chars(up, &status);
+		status = receive_chars(up, status);
 	check_modem_status(up);
 	if (status & UART_LSR_THRE)
 		transmit_chars(up);
-- 
1.7.7

  parent reply	other threads:[~2011-12-04 23:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-01 23:47 [PATCH 0/3] RFC Fix Fsl 8250 BRK bug via letting plat code set bugs Paul Gortmaker
2011-12-01 23:47 ` [PATCH 1/3] serial: make bugs field not specific to 8250 type uarts Paul Gortmaker
2011-12-02  0:51   ` Alan Cox
2011-12-02  1:32     ` Paul Gortmaker
2011-12-02 11:49       ` Alan Cox
2011-12-01 23:47 ` [PATCH 2/3] serial: allow passing in hardware bug info via platform device Paul Gortmaker
2011-12-01 23:47 ` [PATCH 3/3] 8250: add workaround for MPC8[356]xx UART break IRQ storm Paul Gortmaker
2011-12-01 23:51   ` Scott Wood
2011-12-02  0:05     ` Paul Gortmaker
2011-12-02  0:17       ` Kumar Gala
2011-12-02 11:30         ` Alan Cox
2011-12-02 16:34           ` Paul Gortmaker
2011-12-02 17:27             ` Scott Wood
2011-12-02  0:57   ` Alan Cox
2011-12-02  1:42     ` Paul Gortmaker
2011-12-04 23:42 ` [PATCH 0/6] RFCv2 Fix Fsl 8250 BRK bug Paul Gortmaker
2011-12-04 23:42   ` [PATCH 1/6] serial: move struct uart_8250_port from 8250.c to 8250.h Paul Gortmaker
2011-12-04 23:42   ` Paul Gortmaker [this message]
2011-12-04 23:42   ` [PATCH 3/6] serial: export the key functions for an 8250 IRQ handler Paul Gortmaker
2011-12-04 23:42   ` [PATCH 4/6] serial: make 8250 timeout use the specified " Paul Gortmaker
2011-12-04 23:42   ` [PATCH 5/6] serial: manually inline serial8250_handle_port Paul Gortmaker
2011-12-04 23:42   ` [PATCH 6/6] serial: add irq handler for Freescale 16550 errata Paul Gortmaker
2011-12-05 12:18   ` [PATCH 0/6] RFCv2 Fix Fsl 8250 BRK bug Alan Cox

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=1323042143-25330-3-git-send-email-paul.gortmaker@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=alan@linux.intel.com \
    --cc=galak@kernel.crashing.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=scottwood@freescale.com \
    /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;
as well as URLs for NNTP newsgroup(s).