Commit 45e24601 authored by Russell King's avatar Russell King Committed by Russell King

[SERIAL] Move interrupt-time spinlocking inside serial8250_handle_port()

All call sites for serial8250_handle_port() acquired the port spinlock
and released it afterwards.  This is a needless duplication of code.
Move the spinlocking inside serial8250_handle_port().
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 50aec3b5
...@@ -1281,7 +1281,11 @@ static unsigned int check_modem_status(struct uart_8250_port *up) ...@@ -1281,7 +1281,11 @@ static unsigned int check_modem_status(struct uart_8250_port *up)
static inline void static inline void
serial8250_handle_port(struct uart_8250_port *up, struct pt_regs *regs) serial8250_handle_port(struct uart_8250_port *up, struct pt_regs *regs)
{ {
unsigned int status = serial_inp(up, UART_LSR); unsigned int status;
spin_lock(&up->port.lock);
status = serial_inp(up, UART_LSR);
DEBUG_INTR("status = %x...", status); DEBUG_INTR("status = %x...", status);
...@@ -1290,6 +1294,8 @@ serial8250_handle_port(struct uart_8250_port *up, struct pt_regs *regs) ...@@ -1290,6 +1294,8 @@ serial8250_handle_port(struct uart_8250_port *up, struct pt_regs *regs)
check_modem_status(up); check_modem_status(up);
if (status & UART_LSR_THRE) if (status & UART_LSR_THRE)
transmit_chars(up); transmit_chars(up);
spin_unlock(&up->port.lock);
} }
/* /*
...@@ -1325,9 +1331,7 @@ static irqreturn_t serial8250_interrupt(int irq, void *dev_id, struct pt_regs *r ...@@ -1325,9 +1331,7 @@ static irqreturn_t serial8250_interrupt(int irq, void *dev_id, struct pt_regs *r
iir = serial_in(up, UART_IIR); iir = serial_in(up, UART_IIR);
if (!(iir & UART_IIR_NO_INT)) { if (!(iir & UART_IIR_NO_INT)) {
spin_lock(&up->port.lock);
serial8250_handle_port(up, regs); serial8250_handle_port(up, regs);
spin_unlock(&up->port.lock);
handled = 1; handled = 1;
...@@ -1426,11 +1430,8 @@ static void serial8250_timeout(unsigned long data) ...@@ -1426,11 +1430,8 @@ static void serial8250_timeout(unsigned long data)
unsigned int iir; unsigned int iir;
iir = serial_in(up, UART_IIR); iir = serial_in(up, UART_IIR);
if (!(iir & UART_IIR_NO_INT)) { if (!(iir & UART_IIR_NO_INT))
spin_lock(&up->port.lock);
serial8250_handle_port(up, NULL); serial8250_handle_port(up, NULL);
spin_unlock(&up->port.lock);
}
timeout = up->port.timeout; timeout = up->port.timeout;
timeout = timeout > 6 ? (timeout / 2 - 2) : 1; timeout = timeout > 6 ? (timeout / 2 - 2) : 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment