Listing 1. Small, Fast Serial ISR to Minimise Instruction-Cache
Thrashing

static irqreturn_t serial8250_interrupt(int irq, void *dev_id)
{
    struct irq_info       *i = dev_id;
    struct list_head      *l;
    struct uart_8250_port *up;
    unsigned int          lsr;
    unsigned char         ch;
    unsigned int          iir;
    int                   count = 0;

    spin_lock(&i->lock);

    l = i->head;
    up = list_entry(l, struct uart_8250_port, list);

    lsr = serial_inp(up, UART_LSR);

    while (lsr & UART_LSR_DR) {
        ch = serial_inp(up, UART_RX);
        ch = mp_buffertxrx(ch);
        serial_outp(up, UART_TX, ch);
        lsr = serial_inp(up, UART_LSR);
        count++;
    }

    spin_unlock(&i->lock);

    return IRQ_RETVAL(1);
}

