linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Shiyan <shc_work@mail.ru>
To: linux-serial@vger.kernel.org
Cc: Alan Cox <alan@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Alexander Shiyan <shc_work@mail.ru>
Subject: [PATCH 03/12] serial: clps711x: Do not use "uart_port->unused" field
Date: Sun, 14 Oct 2012 11:05:25 +0400	[thread overview]
Message-ID: <1350198334-18737-3-git-send-email-shc_work@mail.ru> (raw)
In-Reply-To: <1350198334-18737-1-git-send-email-shc_work@mail.ru>


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/tty/serial/clps711x.c |   32 +++++++++++++++++---------------
 1 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c
index de6aa33..3b17d19 100644
--- a/drivers/tty/serial/clps711x.c
+++ b/drivers/tty/serial/clps711x.c
@@ -56,11 +56,10 @@
 
 #define UART_ANY_ERR		(UARTDR_FRMERR | UARTDR_PARERR | UARTDR_OVERR)
 
-#define tx_enabled(port)	((port)->unused[0])
-
 struct clps711x_port {
 	struct uart_driver	uart;
 	struct uart_port	port[UART_CLPS711X_NR];
+	int			tx_enabled[UART_CLPS711X_NR];
 #ifdef CONFIG_SERIAL_CLPS711X_CONSOLE
 	struct console		console;
 #endif
@@ -68,17 +67,21 @@ struct clps711x_port {
 
 static void clps711xuart_stop_tx(struct uart_port *port)
 {
-	if (tx_enabled(port)) {
+	struct clps711x_port *s = dev_get_drvdata(port->dev);
+
+	if (s->tx_enabled[port->line]) {
 		disable_irq(TX_IRQ(port));
-		tx_enabled(port) = 0;
+		s->tx_enabled[port->line] = 0;
 	}
 }
 
 static void clps711xuart_start_tx(struct uart_port *port)
 {
-	if (!tx_enabled(port)) {
+	struct clps711x_port *s = dev_get_drvdata(port->dev);
+
+	if (!s->tx_enabled[port->line]) {
 		enable_irq(TX_IRQ(port));
-		tx_enabled(port) = 1;
+		s->tx_enabled[port->line] = 1;
 	}
 }
 
@@ -148,6 +151,7 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id)
 static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id)
 {
 	struct uart_port *port = dev_id;
+	struct clps711x_port *s = dev_get_drvdata(port->dev);
 	struct circ_buf *xmit = &port->state->xmit;
 	int count;
 
@@ -158,8 +162,11 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id)
 		return IRQ_HANDLED;
 	}
 
-	if (uart_circ_empty(xmit) || uart_tx_stopped(port))
-		goto disable_tx_irq;
+	if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
+		disable_irq_nosync(TX_IRQ(port));
+		s->tx_enabled[port->line] = 0;
+		return IRQ_HANDLED;
+	}
 
 	count = port->fifosize >> 1;
 	do {
@@ -173,12 +180,6 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id)
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 		uart_write_wakeup(port);
 
-	if (uart_circ_empty(xmit)) {
-	disable_tx_irq:
-		disable_irq_nosync(TX_IRQ(port));
-		tx_enabled(port) = 0;
-	}
-
 	return IRQ_HANDLED;
 }
 
@@ -230,10 +231,11 @@ static void clps711xuart_break_ctl(struct uart_port *port, int break_state)
 
 static int clps711xuart_startup(struct uart_port *port)
 {
+	struct clps711x_port *s = dev_get_drvdata(port->dev);
 	unsigned int syscon;
 	int retval;
 
-	tx_enabled(port) = 1;
+	s->tx_enabled[port->line] = 1;
 
 	/*
 	 * Allocate the IRQs
-- 
1.7.8.6


  parent reply	other threads:[~2012-10-14  7:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-14  7:05 [PATCH 01/12] serial: clps711x: Add platform_driver interface to clps711x driver Alexander Shiyan
2012-10-14  7:05 ` [PATCH 02/12] serial: clps711x: Convert all static variables to dynamic Alexander Shiyan
2012-10-14  7:05 ` Alexander Shiyan [this message]
2012-10-14  7:05 ` [PATCH 04/12] serial: clps711x: Using CPU clock subsystem for getting base UART speed Alexander Shiyan
2012-10-14  7:05 ` [PATCH 05/12] serial: clps711x: Improved TX FIFO handling Alexander Shiyan
2012-10-14  7:05 ` [PATCH 06/12] serial: clps711x: Return valid modem controls for port that not support it Alexander Shiyan
2012-10-14  7:05 ` [PATCH 07/12] serial: clps711x: Fix break control handling Alexander Shiyan
2012-10-14  7:05 ` [PATCH 08/12] serial: clps711x: Check for valid TTY in RX-interrupt Alexander Shiyan
2012-10-14  7:05 ` [PATCH 09/12] serial: clps711x: Using resource-managed functions Alexander Shiyan
2012-10-14  7:05 ` [PATCH 10/12] serial: clps711x: Disable "break"-state before port startup Alexander Shiyan
2012-10-14  7:05 ` [PATCH 11/12] serial: clps711x: Fix TERMIOS-flags handling Alexander Shiyan
2012-10-14  7:05 ` [PATCH 12/12] serial: clps711x: Cleanup driver Alexander Shiyan
2012-10-14  7:54 ` [PATCH 01/12] serial: clps711x: Add platform_driver interface to clps711x driver Arnd Bergmann

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=1350198334-18737-3-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=alan@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-serial@vger.kernel.org \
    /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).