Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1674757

[PATCH 12/20] serial: stm32: fix last_res value

From Bich HEMON <bich.hemon@st.com>
Newsgroups linux.kernel
Subject [PATCH 12/20] serial: stm32: fix last_res value
Date 2017-06-26 15:00 +0200
Message-ID <tWBMv-2tb-47@gated-at.bofh.it> (permalink)
References <tWBMt-2tb-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Bich Hemon <bich.hemon@st.com>

Set last_res value in each port

Signed-off-by: Bich Hemon <bich.hemon@st.com>
---
 drivers/tty/serial/stm32-usart.c | 6 +++---
 drivers/tty/serial/stm32-usart.h | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index a7401b0..c54b89d 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -155,14 +155,13 @@ static void stm32_receive_chars(struct uart_port *port, bool threaded)
 	unsigned long c;
 	u32 sr;
 	char flag;
-	static int last_res = RX_BUF_L;
 
 	if (port->irq_wake)
 		pm_wakeup_event(tport->tty->dev, 0);
 
-	while (stm32_pending_rx(port, &sr, &last_res, threaded)) {
+	while (stm32_pending_rx(port, &sr, &stm32_port->last_res, threaded)) {
 		sr |= USART_SR_DUMMY_RX;
-		c = stm32_get_char(port, &sr, &last_res);
+		c = stm32_get_char(port, &sr, &stm32_port->last_res);
 		flag = TTY_NORMAL;
 		port->icount.rx++;
 
@@ -808,6 +807,7 @@ static struct stm32_port *stm32_of_get_stm32_port(struct platform_device *pdev)
 	stm32_ports[id].port.line = id;
 	stm32_ports[id].fifoen = true;
 	stm32_ports[id].rx_irq = USART_CR1_RXNEIE;
+	stm32_ports[id].last_res = RX_BUF_L;
 	return &stm32_ports[id];
 }
 
diff --git a/drivers/tty/serial/stm32-usart.h b/drivers/tty/serial/stm32-usart.h
index f9fe15b..056a837 100644
--- a/drivers/tty/serial/stm32-usart.h
+++ b/drivers/tty/serial/stm32-usart.h
@@ -226,6 +226,7 @@ struct stm32_port {
 	dma_addr_t tx_dma_buf;   /* dma tx buffer bus address */
 	unsigned char *tx_buf;   /* dma tx buffer cpu address */
 	u32 rx_irq;		 /* USART_CR1_RXNEIE or RTOIE */
+	int last_res;
 	bool tx_dma_busy;	 /* dma tx busy               */
 	bool hw_flow_control;
 	bool fifoen;
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/20] Update STM32 usart driver Bich HEMON <bich.hemon@st.com> - 2017-06-26 15:00 +0200
  [PATCH 19/20] serial: stm32: add dma rx callback Bich HEMON <bich.hemon@st.com> - 2017-06-26 15:00 +0200
  [PATCH 06/20] serial: stm32: fix pio transmit timeout Bich HEMON <bich.hemon@st.com> - 2017-06-26 15:00 +0200
  [PATCH 14/20] dt-bindings: serial: document option wake-up interrupt  for STM32 USART Bich HEMON <bich.hemon@st.com> - 2017-06-26 15:00 +0200
    Re: [PATCH 14/20] dt-bindings: serial: document option wake-up  interrupt for STM32 USART Rob Herring <robh@kernel.org> - 2017-06-28 20:20 +0200
    Re: [PATCH 14/20] dt-bindings: serial: document option wake-up  interrupt for STM32 USART Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-29 17:00 +0200
  [PATCH 12/20] serial: stm32: fix last_res value Bich HEMON <bich.hemon@st.com> - 2017-06-26 15:00 +0200
  [PATCH 13/20] serial: stm32: fix error handling in probe Bich HEMON <bich.hemon@st.com> - 2017-06-26 15:00 +0200
    Re: [PATCH 13/20] serial: stm32: fix error handling in probe Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-29 17:00 +0200
  [PATCH 04/20] serial: stm32: make fifoen as property for each port Bich HEMON <bich.hemon@st.com> - 2017-06-26 15:00 +0200
  [PATCH 08/20] serial: stm32: timeout interrupt using with dma Bich HEMON <bich.hemon@st.com> - 2017-06-26 15:00 +0200
  Re: [PATCH 00/20] Update STM32 usart driver Alexandre Torgue <alexandre.torgue@st.com> - 2017-06-29 17:20 +0200

csiph-web