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>
This commit is contained in:
Maarten Brock 2016-02-16 18:59:03 +01:00 committed by Greg Kroah-Hartman
parent 2905697a82
commit 19606eaf0b
1 changed files with 4 additions and 5 deletions

View File

@ -193,19 +193,18 @@ static int ulite_transmit(struct uart_port *port, int stat)
static irqreturn_t ulite_isr(int irq, void *dev_id) static irqreturn_t ulite_isr(int irq, void *dev_id)
{ {
struct uart_port *port = dev_id; struct uart_port *port = dev_id;
int busy, n = 0; int stat, busy, n = 0;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&port->lock, flags);
do { 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_receive(port, stat);
busy |= ulite_transmit(port, stat); busy |= ulite_transmit(port, stat);
spin_unlock_irqrestore(&port->lock, flags);
n++; n++;
} while (busy); } while (busy);
spin_unlock_irqrestore(&port->lock, flags);
/* work done? */ /* work done? */
if (n > 1) { if (n > 1) {
tty_flip_buffer_push(&port->state->port); tty_flip_buffer_push(&port->state->port);