Commit 04c34016 authored by Russell King's avatar Russell King

[SERIAL] Locking fixup (part 2)

After the last few days of debugging, we've ended up with the caller
of the start_tx and stop_tx methods taking the per-port lock.  This
cset and the accompanying csets make the same change to some of the
other methods for consistency reasons.  Since these methods don't
contain a lot of code, it is better that they have consistent locking
rules.

This cset fixes up the enable_ms method.
parent 166c0fe8
...@@ -145,8 +145,9 @@ hardware. ...@@ -145,8 +145,9 @@ hardware.
enable_ms(port) enable_ms(port)
Enable the modem status interrupts. Enable the modem status interrupts.
Locking: none. Locking: port->lock taken.
Interrupts: caller dependent. Interrupts: locally disabled.
This call must not sleep
break_ctl(port,ctl) break_ctl(port,ctl)
Control the transmission of a break signal. If ctl is Control the transmission of a break signal. If ctl is
......
...@@ -733,12 +733,9 @@ static void serial8250_stop_rx(struct uart_port *port) ...@@ -733,12 +733,9 @@ static void serial8250_stop_rx(struct uart_port *port)
static void serial8250_enable_ms(struct uart_port *port) static void serial8250_enable_ms(struct uart_port *port)
{ {
struct uart_8250_port *up = (struct uart_8250_port *)port; struct uart_8250_port *up = (struct uart_8250_port *)port;
unsigned long flags;
spin_lock_irqsave(&up->port.lock, flags);
up->ier |= UART_IER_MSI; up->ier |= UART_IER_MSI;
serial_out(up, UART_IER, up->ier); serial_out(up, UART_IER, up->ier);
spin_unlock_irqrestore(&up->port.lock, flags);
} }
static _INLINE_ void static _INLINE_ void
...@@ -1360,6 +1357,12 @@ serial8250_change_speed(struct uart_port *port, unsigned int cflag, ...@@ -1360,6 +1357,12 @@ serial8250_change_speed(struct uart_port *port, unsigned int cflag,
if ((cflag & CREAD) == 0) if ((cflag & CREAD) == 0)
up->port.ignore_status_mask |= UART_LSR_DR; up->port.ignore_status_mask |= UART_LSR_DR;
/*
* Ok, we're now changing the port state. Do it with
* interrupts disabled.
*/
spin_lock_irqsave(&up->port.lock, flags);
/* /*
* CTS flow control flag and modem status interrupts * CTS flow control flag and modem status interrupts
*/ */
...@@ -1367,11 +1370,6 @@ serial8250_change_speed(struct uart_port *port, unsigned int cflag, ...@@ -1367,11 +1370,6 @@ serial8250_change_speed(struct uart_port *port, unsigned int cflag,
if (UART_ENABLE_MS(&up->port, cflag)) if (UART_ENABLE_MS(&up->port, cflag))
up->ier |= UART_IER_MSI; up->ier |= UART_IER_MSI;
/*
* Ok, we're now changing the port state. Do it with
* interrupts disabled.
*/
spin_lock_irqsave(&up->port.lock, flags);
serial_out(up, UART_IER, up->ier); serial_out(up, UART_IER, up->ier);
if (uart_config[up->port.type].flags & UART_STARTECH) { if (uart_config[up->port.type].flags & UART_STARTECH) {
......
...@@ -147,14 +147,11 @@ static void ambauart_stop_rx(struct uart_port *port) ...@@ -147,14 +147,11 @@ static void ambauart_stop_rx(struct uart_port *port)
static void ambauart_enable_ms(struct uart_port *port) static void ambauart_enable_ms(struct uart_port *port)
{ {
unsigned long flags;
unsigned int cr; unsigned int cr;
spin_lock_irqsave(&port->lock, flags);
cr = UART_GET_CR(port); cr = UART_GET_CR(port);
cr |= AMBA_UARTCR_MSIE; cr |= AMBA_UARTCR_MSIE;
UART_PUT_CR(port, cr); UART_PUT_CR(port, cr);
spin_unlock_irqrestore(&port->lock, flags);
} }
static void static void
......
...@@ -931,12 +931,12 @@ uart_wait_modem_status(struct uart_info *info, unsigned long arg) ...@@ -931,12 +931,12 @@ uart_wait_modem_status(struct uart_info *info, unsigned long arg)
*/ */
spin_lock_irq(&port->lock); spin_lock_irq(&port->lock);
memcpy(&cprev, &port->icount, sizeof(struct uart_icount)); memcpy(&cprev, &port->icount, sizeof(struct uart_icount));
spin_unlock_irq(&port->lock);
/* /*
* Force modem status interrupts on * Force modem status interrupts on
*/ */
port->ops->enable_ms(port); port->ops->enable_ms(port);
spin_unlock_irq(&port->lock);
add_wait_queue(&info->delta_msr_wait, &wait); add_wait_queue(&info->delta_msr_wait, &wait);
for (;;) { for (;;) {
......
...@@ -423,7 +423,9 @@ static int sa1100_startup(struct uart_port *port) ...@@ -423,7 +423,9 @@ static int sa1100_startup(struct uart_port *port)
/* /*
* Enable modem status interrupts * Enable modem status interrupts
*/ */
spin_lock_irq(&sport->port.lock);
sa1100_enable_ms(&sport->port); sa1100_enable_ms(&sport->port);
spin_unlock_irq(&sport->port.lock);
return 0; return 0;
} }
...@@ -524,10 +526,11 @@ sa1100_change_speed(struct uart_port *port, unsigned int cflag, ...@@ -524,10 +526,11 @@ sa1100_change_speed(struct uart_port *port, unsigned int cflag,
UART_PUT_UTSR0(sport, -1); UART_PUT_UTSR0(sport, -1);
UART_PUT_UTCR3(sport, old_utcr3); UART_PUT_UTCR3(sport, old_utcr3);
spin_unlock_irqrestore(&sport->port.lock, flags);
if (UART_ENABLE_MS(&sport->port, cflag)) if (UART_ENABLE_MS(&sport->port, cflag))
sa1100_enable_ms(&sport->port); sa1100_enable_ms(&sport->port);
spin_unlock_irqrestore(&sport->port.lock, flags);
} }
static const char *sa1100_type(struct uart_port *port) static const char *sa1100_type(struct uart_port *port)
......
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