Skip to content

Commit

Permalink
serial-uartlite: Spinlock inside the loop.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Maarten Brock authored and Greg Kroah-Hartman committed Mar 8, 2016
1 parent 2905697 commit 19606ea
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/tty/serial/uartlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 19606ea

Please sign in to comment.