summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHugo Villeneuve <hvilleneuve@dimonoff.com>2023-12-21 18:18:12 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-01-31 16:17:02 -0800
commit0e0653d53af88120893a58164dff4dbb92c0b0b7 (patch)
tree577d0d52a5117dafafb1cc5be91426b2dfe7bc33 /drivers
parent80beb4424d48701f0e4cf924fb5263ce98a796f8 (diff)
downloadlinux-stable-0e0653d53af88120893a58164dff4dbb92c0b0b7.tar.gz
linux-stable-0e0653d53af88120893a58164dff4dbb92c0b0b7.tar.bz2
linux-stable-0e0653d53af88120893a58164dff4dbb92c0b0b7.zip
serial: sc16is7xx: improve do/while loop in sc16is7xx_irq()
commit d5078509c8b06c5c472a60232815e41af81c6446 upstream. 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: 834449872105 ("sc16is7xx: Fix for multi-channel stall") Cc: <stable@vger.kernel.org> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20231221231823.2327894-6-hugo@hugovil.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/sc16is7xx.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 6bce1a6c0496..ab9159441d02 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -784,17 +784,18 @@ out_port_irq:
static irqreturn_t sc16is7xx_irq(int irq, void *dev_id)
{
+ bool keep_polling;
+
struct sc16is7xx_port *s = (struct sc16is7xx_port *)dev_id;
- while (1) {
- bool keep_polling = false;
+ do {
int i;
+ keep_polling = false;
+
for (i = 0; i < s->devtype->nr_uart; ++i)
keep_polling |= sc16is7xx_port_irq(s, i);
- if (!keep_polling)
- break;
- }
+ } while (keep_polling);
return IRQ_HANDLED;
}