Commit 166c0fe8 authored by Russell King's avatar Russell King

[SERIAL] Locking fixup (part 1)

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 stop_rx method.
parent c75efab2
......@@ -138,8 +138,8 @@ hardware.
Stop receiving characters; the port is in the process of
being closed.
Locking: none.
Interrupts: caller dependent.
Locking: port->lock taken.
Interrupts: locally disabled.
This call must not sleep
enable_ms(port)
......
......@@ -85,14 +85,10 @@ serial21285_start_tx(struct uart_port *port, unsigned int tty_start)
static void serial21285_stop_rx(struct uart_port *port)
{
unsigned long flags;
spin_lock_irqsave(&port->lock, flags);
if (rx_enabled(port)) {
disable_irq(IRQ_CONRX);
rx_enabled(port) = 0;
}
spin_unlock_irqrestore(&port->lock, flags);
}
static void serial21285_enable_ms(struct uart_port *port)
......
......@@ -724,13 +724,10 @@ static void serial8250_start_tx(struct uart_port *port, unsigned int tty_start)
static void serial8250_stop_rx(struct uart_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_RLSI;
up->port.read_status_mask &= ~UART_LSR_DR;
serial_out(up, UART_IER, up->ier);
spin_unlock_irqrestore(&up->port.lock, flags);
}
static void serial8250_enable_ms(struct uart_port *port)
......
......@@ -138,14 +138,11 @@ static void ambauart_start_tx(struct uart_port *port, unsigned int tty_start)
static void ambauart_stop_rx(struct uart_port *port)
{
unsigned long flags;
unsigned int cr;
spin_lock_irqsave(&port->lock, flags);
cr = UART_GET_CR(port);
cr &= ~(AMBA_UARTCR_RIE | AMBA_UARTCR_RTIE);
UART_PUT_CR(port, cr);
spin_unlock_irqrestore(&port->lock, flags);
}
static void ambauart_enable_ms(struct uart_port *port)
......
......@@ -119,13 +119,9 @@ anakin_start_tx(struct uart_port *port, unsigned int tty_start)
static void
anakin_stop_rx(struct uart_port *port)
{
unsigned long flags;
spin_lock_irqsave(&port->lock, flags);
while (anakin_in(port, 0x10) & RXRELEASE)
anakin_in(port, 0x14);
anakin_out(port, 0x18, anakin_in(port, 0x18) | BLOCKRX);
spin_unlock_irqrestore(&port->lock, flags);
}
static void
......
......@@ -1200,7 +1200,9 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
* disable the receive line status interrupts.
*/
if (info->flags & UIF_INITIALIZED) {
spin_lock_irqsave(&port->lock, flags);
port->ops->stop_rx(port);
spin_unlock_irqrestore(&port->lock, flags);
/*
* Before we drop DTR, make sure the UART transmitter
* has completely drained; this is especially
......@@ -1948,8 +1950,8 @@ static int uart_pm_set_state(struct uart_state *state, int pm_state, int oldstat
spin_lock_irq(&port->lock);
ops->stop_tx(port, 0);
ops->set_mctrl(port, 0);
spin_unlock_irq(&port->lock);
ops->stop_rx(port);
spin_unlock_irq(&port->lock);
ops->shutdown(port);
}
if (ops->pm)
......
......@@ -190,13 +190,10 @@ static void sa1100_start_tx(struct uart_port *port, unsigned int tty_start)
static void sa1100_stop_rx(struct uart_port *port)
{
struct sa1100_port *sport = (struct sa1100_port *)port;
unsigned long flags;
u32 utcr3;
spin_lock_irqsave(&sport->port.lock, flags);
utcr3 = UART_GET_UTCR3(sport);
UART_PUT_UTCR3(sport, utcr3 & ~UTCR3_RIE);
spin_unlock_irqrestore(&sport->port.lock, flags);
}
/*
......
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