summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/uartlite.c
diff options
context:
space:
mode:
authorMaarten Brock <m.brock@vanmierlo.com>2016-02-16 20:59:03 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-08 03:11:14 +0300
commit19606eaf0b7b791fd5ecb61017ce0b367cce74a0 (patch)
tree33ef15fb275b67d7e298c441b3b95e713a6e45fd /drivers/tty/serial/uartlite.c
parent2905697a82eaf20606ced164d853b52d1b94aaa8 (diff)
downloadlinux-19606eaf0b7b791fd5ecb61017ce0b367cce74a0.tar.xz
serial-uartlite: Spinlock inside the loop.
Better to hold the spinlock as short as possible. Signed-off-by: Maarten Brock <m.brock@vanmierlo.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/uartlite.c')
-rw-r--r--drivers/tty/serial/uartlite.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index f4ad0db74dca..9ffbeef913e1 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -193,19 +193,18 @@ static int ulite_transmit(struct uart_port *port, int stat)
static irqreturn_t ulite_isr(int irq, void *dev_id)
{
struct uart_port *port = dev_id;
- int busy, n = 0;
+ int stat, busy, n = 0;
unsigned long flags;
- spin_lock_irqsave(&port->lock, flags);
do {
- int stat = uart_in32(ULITE_STATUS, port);
+ spin_lock_irqsave(&port->lock, flags);
+ stat = uart_in32(ULITE_STATUS, port);
busy = ulite_receive(port, stat);
busy |= ulite_transmit(port, stat);
+ spin_unlock_irqrestore(&port->lock, flags);
n++;
} while (busy);
- spin_unlock_irqrestore(&port->lock, flags);
-
/* work done? */
if (n > 1) {
tty_flip_buffer_push(&port->state->port);