diff mbox series

[v4,6/9] serial: 8250: dw: Introduce an rx_timeout variable in the IRQ path

Message ID 20220330132038.808679-7-miquel.raynal@bootlin.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series serial: 8250: dw: RZN1 DMA support | expand

Commit Message

Miquel Raynal March 30, 2022, 1:20 p.m. UTC
In a next change we are going to need the same Rx timeout condition as
we already have in the IRQ handling code. Let's just create a boolean to
clarify what this operation does before reusing it.

There is no functional change.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/tty/serial/8250/8250_dw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andy Shevchenko March 30, 2022, 2:14 p.m. UTC | #1
On Wed, Mar 30, 2022 at 03:20:35PM +0200, Miquel Raynal wrote:
> In a next change we are going to need the same Rx timeout condition as
> we already have in the IRQ handling code. Let's just create a boolean to
> clarify what this operation does before reusing it.
> 
> There is no functional change.

OK!

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  drivers/tty/serial/8250/8250_dw.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> index 70a843e31ffd..a156c6d2f866 100644
> --- a/drivers/tty/serial/8250/8250_dw.c
> +++ b/drivers/tty/serial/8250/8250_dw.c
> @@ -223,6 +223,7 @@ static int dw8250_handle_irq(struct uart_port *p)
>  	struct uart_8250_port *up = up_to_u8250p(p);
>  	struct dw8250_data *d = to_dw8250_data(p->private_data);
>  	unsigned int iir = p->serial_in(p, UART_IIR);
> +	bool rx_timeout = (iir & 0x3f) == UART_IIR_RX_TIMEOUT;
>  	unsigned int status;
>  	unsigned long flags;
>  
> @@ -236,7 +237,7 @@ static int dw8250_handle_irq(struct uart_port *p)
>  	 * This problem has only been observed so far when not in DMA mode
>  	 * so we limit the workaround only to non-DMA mode.
>  	 */
> -	if (!up->dma && ((iir & 0x3f) == UART_IIR_RX_TIMEOUT)) {
> +	if (!up->dma && rx_timeout) {
>  		spin_lock_irqsave(&p->lock, flags);
>  		status = p->serial_in(p, UART_LSR);
>  
> -- 
> 2.27.0
>
diff mbox series

Patch

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index 70a843e31ffd..a156c6d2f866 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -223,6 +223,7 @@  static int dw8250_handle_irq(struct uart_port *p)
 	struct uart_8250_port *up = up_to_u8250p(p);
 	struct dw8250_data *d = to_dw8250_data(p->private_data);
 	unsigned int iir = p->serial_in(p, UART_IIR);
+	bool rx_timeout = (iir & 0x3f) == UART_IIR_RX_TIMEOUT;
 	unsigned int status;
 	unsigned long flags;
 
@@ -236,7 +237,7 @@  static int dw8250_handle_irq(struct uart_port *p)
 	 * This problem has only been observed so far when not in DMA mode
 	 * so we limit the workaround only to non-DMA mode.
 	 */
-	if (!up->dma && ((iir & 0x3f) == UART_IIR_RX_TIMEOUT)) {
+	if (!up->dma && rx_timeout) {
 		spin_lock_irqsave(&p->lock, flags);
 		status = p->serial_in(p, UART_LSR);