serial: 8250: dw: Introduce an rx_timeout variable in the IRQ path
authorMiquel Raynal <miquel.raynal@bootlin.com>
Fri, 22 Apr 2022 18:06:12 +0000 (20:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Apr 2022 11:25:47 +0000 (13:25 +0200)
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.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20220422180615.9098-7-miquel.raynal@bootlin.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_dw.c

index b34edc88af3da68c4ce02c9fb0e0e12577be8b6e..ef3f05c82ad60e1aeb1aa15ab11ed75b91fbb508 100644 (file)
@@ -225,6 +225,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;
 
@@ -238,7 +239,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);