Skip to content

Commit ed64725

Browse files
hvilleneuvedoogregkh
authored andcommitted
serial: sc16is7xx: remove obsolete loop in sc16is7xx_port_irq()
Commit 8344498 ("sc16is7xx: Fix for multi-channel stall") changed sc16is7xx_port_irq() from looping multiple times when there was still interrupts to serve. It simply changed the do {} while(1) loop to a do {} while(0) loop, which makes the loop itself now obsolete. Clean the code by removing this obsolete do {} while(0) loop. Fixes: 8344498 ("sc16is7xx: Fix for multi-channel stall") Cc: <[email protected]> Suggested-by: Andy Shevchenko <[email protected]> Signed-off-by: Hugo Villeneuve <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3ef79cd commit ed64725

File tree

1 file changed

+41
-44
lines changed

1 file changed

+41
-44
lines changed

drivers/tty/serial/sc16is7xx.c

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -725,58 +725,55 @@ static void sc16is7xx_update_mlines(struct sc16is7xx_one *one)
725725
static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno)
726726
{
727727
bool rc = true;
728+
unsigned int iir, rxlen;
728729
struct uart_port *port = &s->p[portno].port;
729730
struct sc16is7xx_one *one = to_sc16is7xx_one(port, port);
730731

731732
mutex_lock(&one->efr_lock);
732733

733-
do {
734-
unsigned int iir, rxlen;
734+
iir = sc16is7xx_port_read(port, SC16IS7XX_IIR_REG);
735+
if (iir & SC16IS7XX_IIR_NO_INT_BIT) {
736+
rc = false;
737+
goto out_port_irq;
738+
}
735739

736-
iir = sc16is7xx_port_read(port, SC16IS7XX_IIR_REG);
737-
if (iir & SC16IS7XX_IIR_NO_INT_BIT) {
738-
rc = false;
739-
goto out_port_irq;
740-
}
740+
iir &= SC16IS7XX_IIR_ID_MASK;
741741

742-
iir &= SC16IS7XX_IIR_ID_MASK;
743-
744-
switch (iir) {
745-
case SC16IS7XX_IIR_RDI_SRC:
746-
case SC16IS7XX_IIR_RLSE_SRC:
747-
case SC16IS7XX_IIR_RTOI_SRC:
748-
case SC16IS7XX_IIR_XOFFI_SRC:
749-
rxlen = sc16is7xx_port_read(port, SC16IS7XX_RXLVL_REG);
750-
751-
/*
752-
* There is a silicon bug that makes the chip report a
753-
* time-out interrupt but no data in the FIFO. This is
754-
* described in errata section 18.1.4.
755-
*
756-
* When this happens, read one byte from the FIFO to
757-
* clear the interrupt.
758-
*/
759-
if (iir == SC16IS7XX_IIR_RTOI_SRC && !rxlen)
760-
rxlen = 1;
761-
762-
if (rxlen)
763-
sc16is7xx_handle_rx(port, rxlen, iir);
764-
break;
742+
switch (iir) {
743+
case SC16IS7XX_IIR_RDI_SRC:
744+
case SC16IS7XX_IIR_RLSE_SRC:
745+
case SC16IS7XX_IIR_RTOI_SRC:
746+
case SC16IS7XX_IIR_XOFFI_SRC:
747+
rxlen = sc16is7xx_port_read(port, SC16IS7XX_RXLVL_REG);
748+
749+
/*
750+
* There is a silicon bug that makes the chip report a
751+
* time-out interrupt but no data in the FIFO. This is
752+
* described in errata section 18.1.4.
753+
*
754+
* When this happens, read one byte from the FIFO to
755+
* clear the interrupt.
756+
*/
757+
if (iir == SC16IS7XX_IIR_RTOI_SRC && !rxlen)
758+
rxlen = 1;
759+
760+
if (rxlen)
761+
sc16is7xx_handle_rx(port, rxlen, iir);
762+
break;
765763
/* CTSRTS interrupt comes only when CTS goes inactive */
766-
case SC16IS7XX_IIR_CTSRTS_SRC:
767-
case SC16IS7XX_IIR_MSI_SRC:
768-
sc16is7xx_update_mlines(one);
769-
break;
770-
case SC16IS7XX_IIR_THRI_SRC:
771-
sc16is7xx_handle_tx(port);
772-
break;
773-
default:
774-
dev_err_ratelimited(port->dev,
775-
"ttySC%i: Unexpected interrupt: %x",
776-
port->line, iir);
777-
break;
778-
}
779-
} while (0);
764+
case SC16IS7XX_IIR_CTSRTS_SRC:
765+
case SC16IS7XX_IIR_MSI_SRC:
766+
sc16is7xx_update_mlines(one);
767+
break;
768+
case SC16IS7XX_IIR_THRI_SRC:
769+
sc16is7xx_handle_tx(port);
770+
break;
771+
default:
772+
dev_err_ratelimited(port->dev,
773+
"ttySC%i: Unexpected interrupt: %x",
774+
port->line, iir);
775+
break;
776+
}
780777

781778
out_port_irq:
782779
mutex_unlock(&one->efr_lock);

0 commit comments

Comments
 (0)