linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] pch_uart: Delete unused structure member
@ 2012-03-26  5:43 Tomoya MORINAGA
  2012-03-26  5:43 ` [PATCH 2/7] pch_uart: change type to u8 Tomoya MORINAGA
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Tomoya MORINAGA @ 2012-03-26  5:43 UTC (permalink / raw)
  To: Alan Cox, Greg Kroah-Hartman, linux-serial, linux-kernel
  Cc: qi.wang, yong.y.wang, joel.clark, kok.howg.ewe, Tomoya MORINAGA


Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
---
 drivers/tty/serial/pch_uart.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 332f2eb..80609e4 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -236,7 +236,6 @@ struct eg20t_port {
 	unsigned int fcr;
 	unsigned int mcr;
 	unsigned int use_dma;
-	unsigned int use_dma_flag;
 	struct dma_async_tx_descriptor	*desc_tx;
 	struct dma_async_tx_descriptor	*desc_rx;
 	struct pch_dma_slave		param_tx;
@@ -1445,7 +1444,6 @@ static int pch_uart_verify_port(struct uart_port *port,
 		return -EOPNOTSUPP;
 #endif
 		priv->use_dma = 1;
-		priv->use_dma_flag = 1;
 		dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n");
 	}
 
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/7] pch_uart: change type to u8
  2012-03-26  5:43 [PATCH 1/7] pch_uart: Delete unused structure member Tomoya MORINAGA
@ 2012-03-26  5:43 ` Tomoya MORINAGA
  2012-03-26  5:43 ` [PATCH 3/7] pch_uart: change type to %d to %02x Tomoya MORINAGA
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Tomoya MORINAGA @ 2012-03-26  5:43 UTC (permalink / raw)
  To: Alan Cox, Greg Kroah-Hartman, linux-serial, linux-kernel
  Cc: qi.wang, yong.y.wang, joel.clark, kok.howg.ewe, Tomoya MORINAGA

Target uart register access size is 8bit.
However, 32bit is used at 2 points.

This patch modifies type "unsigned int" to "unsigned char".

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
---
 drivers/tty/serial/pch_uart.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 80609e4..6347f01 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -556,14 +556,10 @@ static int pch_uart_hal_read(struct eg20t_port *priv, unsigned char *buf,
 	return i;
 }
 
-static unsigned int pch_uart_hal_get_iid(struct eg20t_port *priv)
+static unsigned char pch_uart_hal_get_iid(struct eg20t_port *priv)
 {
-	unsigned int iir;
-	int ret;
-
-	iir = ioread8(priv->membase + UART_IIR);
-	ret = (iir & (PCH_UART_IIR_IID | PCH_UART_IIR_TOI | PCH_UART_IIR_IP));
-	return ret;
+	return ioread8(priv->membase + UART_IIR) &\
+		      (PCH_UART_IIR_IID | PCH_UART_IIR_TOI | PCH_UART_IIR_IP);
 }
 
 static u8 pch_uart_hal_get_line_status(struct eg20t_port *priv)
@@ -1049,7 +1045,7 @@ static irqreturn_t pch_uart_interrupt(int irq, void *dev_id)
 	unsigned int handled;
 	u8 lsr;
 	int ret = 0;
-	unsigned int iid;
+	unsigned char iid;
 	unsigned long flags;
 
 	spin_lock_irqsave(&priv->port.lock, flags);
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/7] pch_uart: change type to %d to %02x
  2012-03-26  5:43 [PATCH 1/7] pch_uart: Delete unused structure member Tomoya MORINAGA
  2012-03-26  5:43 ` [PATCH 2/7] pch_uart: change type to u8 Tomoya MORINAGA
@ 2012-03-26  5:43 ` Tomoya MORINAGA
  2012-03-26  5:43 ` [PATCH 4/7] pch_uart: Support modem status interrupt Tomoya MORINAGA
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Tomoya MORINAGA @ 2012-03-26  5:43 UTC (permalink / raw)
  To: Alan Cox, Greg Kroah-Hartman, linux-serial, linux-kernel
  Cc: qi.wang, yong.y.wang, joel.clark, kok.howg.ewe, Tomoya MORINAGA

%02x format is easier to understand better than %d.

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
---
 drivers/tty/serial/pch_uart.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 6347f01..c025c4b 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -1087,7 +1087,7 @@ static irqreturn_t pch_uart_interrupt(int irq, void *dev_id)
 			ret = PCH_UART_HANDLED_MS_INT;
 			break;
 		default:	/* Never junp to this label */
-			dev_err(priv->port.dev, "%s:iid=%d (%lu)\n", __func__,
+			dev_err(priv->port.dev, "%s:iid=%02x (%lu)\n", __func__,
 				iid, jiffies);
 			ret = -1;
 			break;
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/7] pch_uart: Support modem status interrupt
  2012-03-26  5:43 [PATCH 1/7] pch_uart: Delete unused structure member Tomoya MORINAGA
  2012-03-26  5:43 ` [PATCH 2/7] pch_uart: change type to u8 Tomoya MORINAGA
  2012-03-26  5:43 ` [PATCH 3/7] pch_uart: change type to %d to %02x Tomoya MORINAGA
@ 2012-03-26  5:43 ` Tomoya MORINAGA
  2012-03-26  5:43 ` [PATCH 5/7] pch_uart: delete unused data structure Tomoya MORINAGA
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Tomoya MORINAGA @ 2012-03-26  5:43 UTC (permalink / raw)
  To: Alan Cox, Greg Kroah-Hartman, linux-serial, linux-kernel
  Cc: qi.wang, yong.y.wang, joel.clark, kok.howg.ewe, Tomoya MORINAGA

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
---
 drivers/tty/serial/pch_uart.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index c025c4b..7a9ef83 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -1047,10 +1047,15 @@ static irqreturn_t pch_uart_interrupt(int irq, void *dev_id)
 	int ret = 0;
 	unsigned char iid;
 	unsigned long flags;
+	int next = 1;
+	u8 msr;
 
 	spin_lock_irqsave(&priv->port.lock, flags);
 	handled = 0;
-	while ((iid = pch_uart_hal_get_iid(priv)) > 1) {
+	while (next) {
+		iid = pch_uart_hal_get_iid(priv);
+		if (iid & PCH_UART_IIR_IP) /* No Interrupt */
+			break;
 		switch (iid) {
 		case PCH_UART_IID_RLS:	/* Receiver Line Status */
 			lsr = pch_uart_hal_get_line_status(priv);
@@ -1084,12 +1089,18 @@ static irqreturn_t pch_uart_interrupt(int irq, void *dev_id)
 				ret = handle_tx(priv);
 			break;
 		case PCH_UART_IID_MS:	/* Modem Status */
-			ret = PCH_UART_HANDLED_MS_INT;
+			msr = pch_uart_hal_get_modem(priv);
+			next = 0; /* MS ir prioirty is the lowest. So, MS ir
+				     means final interrupt */
+			if ((msr & UART_MSR_ANY_DELTA) == 0)
+				break;
+			ret |= PCH_UART_HANDLED_MS_INT;
 			break;
 		default:	/* Never junp to this label */
 			dev_err(priv->port.dev, "%s:iid=%02x (%lu)\n", __func__,
 				iid, jiffies);
 			ret = -1;
+			next = 0;
 			break;
 		}
 		handled |= (unsigned int)ret;
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/7] pch_uart: delete unused data structure
  2012-03-26  5:43 [PATCH 1/7] pch_uart: Delete unused structure member Tomoya MORINAGA
                   ` (2 preceding siblings ...)
  2012-03-26  5:43 ` [PATCH 4/7] pch_uart: Support modem status interrupt Tomoya MORINAGA
@ 2012-03-26  5:43 ` Tomoya MORINAGA
  2012-03-26  5:43 ` [PATCH 6/7] pch_uart: Fix return value issue Tomoya MORINAGA
  2012-03-26  5:43 ` [PATCH 7/7] pch_uart: Fix duplicate memory release issue Tomoya MORINAGA
  5 siblings, 0 replies; 7+ messages in thread
From: Tomoya MORINAGA @ 2012-03-26  5:43 UTC (permalink / raw)
  To: Alan Cox, Greg Kroah-Hartman, linux-serial, linux-kernel
  Cc: qi.wang, yong.y.wang, joel.clark, kok.howg.ewe, Tomoya MORINAGA

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
---
 drivers/tty/serial/pch_uart.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 7a9ef83..020bbf3 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -228,7 +228,6 @@ struct eg20t_port {
 	int start_tx;
 	int start_rx;
 	int tx_empty;
-	int int_dis_flag;
 	int trigger;
 	int trigger_level;
 	struct pch_uart_buffer rxbuf;
@@ -1105,10 +1104,6 @@ static irqreturn_t pch_uart_interrupt(int irq, void *dev_id)
 		}
 		handled |= (unsigned int)ret;
 	}
-	if (handled == 0 && iid <= 1) {
-		if (priv->int_dis_flag)
-			priv->int_dis_flag = 0;
-	}
 
 	spin_unlock_irqrestore(&priv->port.lock, flags);
 	return IRQ_RETVAL(handled);
@@ -1203,7 +1198,6 @@ static void pch_uart_stop_rx(struct uart_port *port)
 	priv = container_of(port, struct eg20t_port, port);
 	priv->start_rx = 0;
 	pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_RX_INT);
-	priv->int_dis_flag = 1;
 }
 
 /* Enable the modem status interrupts. */
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/7] pch_uart: Fix return value issue
  2012-03-26  5:43 [PATCH 1/7] pch_uart: Delete unused structure member Tomoya MORINAGA
                   ` (3 preceding siblings ...)
  2012-03-26  5:43 ` [PATCH 5/7] pch_uart: delete unused data structure Tomoya MORINAGA
@ 2012-03-26  5:43 ` Tomoya MORINAGA
  2012-03-26  5:43 ` [PATCH 7/7] pch_uart: Fix duplicate memory release issue Tomoya MORINAGA
  5 siblings, 0 replies; 7+ messages in thread
From: Tomoya MORINAGA @ 2012-03-26  5:43 UTC (permalink / raw)
  To: Alan Cox, Greg Kroah-Hartman, linux-serial, linux-kernel
  Cc: qi.wang, yong.y.wang, joel.clark, kok.howg.ewe, Tomoya MORINAGA

Currently, occurring line status interrupt,
returned value is not set in interrupt handler function.
As a result, 0 can be returned.

This patch adds setting returned value.

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
---
 drivers/tty/serial/pch_uart.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 020bbf3..6e7f0ac 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -39,6 +39,7 @@ enum {
 	PCH_UART_HANDLED_RX_ERR_INT_SHIFT,
 	PCH_UART_HANDLED_RX_TRG_INT_SHIFT,
 	PCH_UART_HANDLED_MS_INT_SHIFT,
+	PCH_UART_HANDLED_LS_INT_SHIFT,
 };
 
 enum {
@@ -63,6 +64,8 @@ enum {
 					PCH_UART_HANDLED_RX_TRG_INT_SHIFT)<<1))
 #define PCH_UART_HANDLED_MS_INT	(1<<((PCH_UART_HANDLED_MS_INT_SHIFT)<<1))
 
+#define PCH_UART_HANDLED_LS_INT	(1<<((PCH_UART_HANDLED_LS_INT_SHIFT)<<1))
+
 #define PCH_UART_RBR		0x00
 #define PCH_UART_THR		0x00
 
@@ -1062,6 +1065,8 @@ static irqreturn_t pch_uart_interrupt(int irq, void *dev_id)
 						UART_LSR_PE | UART_LSR_OE)) {
 				pch_uart_err_ir(priv, lsr);
 				ret = PCH_UART_HANDLED_RX_ERR_INT;
+			} else {
+				ret = PCH_UART_HANDLED_LS_INT;
 			}
 			break;
 		case PCH_UART_IID_RDR:	/* Received Data Ready */
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 7/7] pch_uart: Fix duplicate memory release issue
  2012-03-26  5:43 [PATCH 1/7] pch_uart: Delete unused structure member Tomoya MORINAGA
                   ` (4 preceding siblings ...)
  2012-03-26  5:43 ` [PATCH 6/7] pch_uart: Fix return value issue Tomoya MORINAGA
@ 2012-03-26  5:43 ` Tomoya MORINAGA
  5 siblings, 0 replies; 7+ messages in thread
From: Tomoya MORINAGA @ 2012-03-26  5:43 UTC (permalink / raw)
  To: Alan Cox, Greg Kroah-Hartman, linux-serial, linux-kernel
  Cc: qi.wang, yong.y.wang, joel.clark, kok.howg.ewe, Tomoya MORINAGA

Add initialize variable to prevent duplicate free memory.

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
---
 drivers/tty/serial/pch_uart.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 6e7f0ac..803847b 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -660,10 +660,13 @@ static void pch_free_dma(struct uart_port *port)
 		dma_release_channel(priv->chan_rx);
 		priv->chan_rx = NULL;
 	}
-	if (sg_dma_address(&priv->sg_rx))
-		dma_free_coherent(port->dev, port->fifosize,
-				  sg_virt(&priv->sg_rx),
-				  sg_dma_address(&priv->sg_rx));
+
+	if (priv->rx_buf_dma) {
+		dma_free_coherent(port->dev, port->fifosize, priv->rx_buf_virt,
+				  priv->rx_buf_dma);
+		priv->rx_buf_virt = NULL;
+		priv->rx_buf_dma = 0;
+	}
 
 	return;
 }
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-03-26  5:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-26  5:43 [PATCH 1/7] pch_uart: Delete unused structure member Tomoya MORINAGA
2012-03-26  5:43 ` [PATCH 2/7] pch_uart: change type to u8 Tomoya MORINAGA
2012-03-26  5:43 ` [PATCH 3/7] pch_uart: change type to %d to %02x Tomoya MORINAGA
2012-03-26  5:43 ` [PATCH 4/7] pch_uart: Support modem status interrupt Tomoya MORINAGA
2012-03-26  5:43 ` [PATCH 5/7] pch_uart: delete unused data structure Tomoya MORINAGA
2012-03-26  5:43 ` [PATCH 6/7] pch_uart: Fix return value issue Tomoya MORINAGA
2012-03-26  5:43 ` [PATCH 7/7] pch_uart: Fix duplicate memory release issue Tomoya MORINAGA

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).