Skip to content

Commit d507850

Browse files
hvilleneuvedoogregkh
authored andcommitted
serial: sc16is7xx: improve do/while loop in sc16is7xx_irq()
Simplify and improve readability by replacing while(1) loop with do {} while, and by using the keep_polling variable as the exit condition, making it more explicit. 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 ed64725 commit d507850

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/tty/serial/sc16is7xx.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -783,17 +783,18 @@ static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno)
783783

784784
static irqreturn_t sc16is7xx_irq(int irq, void *dev_id)
785785
{
786+
bool keep_polling;
787+
786788
struct sc16is7xx_port *s = (struct sc16is7xx_port *)dev_id;
787789

788-
while (1) {
789-
bool keep_polling = false;
790+
do {
790791
int i;
791792

793+
keep_polling = false;
794+
792795
for (i = 0; i < s->devtype->nr_uart; ++i)
793796
keep_polling |= sc16is7xx_port_irq(s, i);
794-
if (!keep_polling)
795-
break;
796-
}
797+
} while (keep_polling);
797798

798799
return IRQ_HANDLED;
799800
}

0 commit comments

Comments
 (0)