target/linux/cns3xxx/patches-2.6.31/210-cns3xxx_smp_serial_fix.patch |
| 1 | --- a/drivers/serial/8250.c |
| 2 | @@ -1743,6 +1743,7 @@ static void serial8250_backup_timeout(un |
| 3 | unsigned int iir, ier = 0, lsr; |
| 4 | unsigned long flags; |
| 5 | |
| 6 | + spin_lock_irqsave(&up->port.lock, flags); |
| 7 | /* |
| 8 | * Must disable interrupts or else we risk racing with the interrupt |
| 9 | * based handler. |
| 10 | @@ -1760,10 +1761,8 @@ static void serial8250_backup_timeout(un |
| 11 | * the "Diva" UART used on the management processor on many HP |
| 12 | * ia64 and parisc boxes. |
| 13 | */ |
| 14 | - spin_lock_irqsave(&up->port.lock, flags); |
| 15 | lsr = serial_in(up, UART_LSR); |
| 16 | up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS; |
| 17 | - spin_unlock_irqrestore(&up->port.lock, flags); |
| 18 | if ((iir & UART_IIR_NO_INT) && (up->ier & UART_IER_THRI) && |
| 19 | (!uart_circ_empty(&up->port.info->xmit) || up->port.x_char) && |
| 20 | (lsr & UART_LSR_THRE)) { |
| 21 | @@ -1771,12 +1770,14 @@ static void serial8250_backup_timeout(un |
| 22 | iir |= UART_IIR_THRI; |
| 23 | } |
| 24 | |
| 25 | - if (!(iir & UART_IIR_NO_INT)) |
| 26 | - serial8250_handle_port(up); |
| 27 | - |
| 28 | if (is_real_interrupt(up->port.irq)) |
| 29 | serial_out(up, UART_IER, ier); |
| 30 | |
| 31 | + spin_unlock_irqrestore(&up->port.lock, flags); |
| 32 | + |
| 33 | + if (!(iir & UART_IIR_NO_INT)) |
| 34 | + serial8250_handle_port(up); |
| 35 | + |
| 36 | /* Standard timer interval plus 0.2s to keep the port running */ |
| 37 | mod_timer(&up->timer, |
| 38 | jiffies + poll_timeout(up->port.timeout) + HZ / 5); |