diff options
author | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> | 2014-11-06 08:23:00 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-06 23:00:44 (GMT) |
commit | bd737f8738b7e15930aa7b47c94c28a8d83148ac (patch) | |
tree | 9140a208d4856074a92ffc6543aabcf08a38a762 /drivers/tty/serial/mcf.c | |
parent | a9c20a9cf3190a517b88d8e08d93157256f97673 (diff) | |
download | linux-bd737f8738b7e15930aa7b47c94c28a8d83148ac.tar.xz |
tty/serial_core: Introduce lock mechanism for RS485
Introduce an homogeneous lock system between setting and using the rs485
data of the uart_port.
This patch should not be split into multiple ones in order to avoid
leaving the tree in an unstable state.
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Reviewed-by: Alan Cox <alan@linux.intel.com>
Suggested-by: Alan Cox <alan@linux.intel.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/mcf.c')
-rw-r--r-- | drivers/tty/serial/mcf.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c index d7be1f1..fdd5c7b 100644 --- a/drivers/tty/serial/mcf.c +++ b/drivers/tty/serial/mcf.c @@ -257,12 +257,12 @@ static void mcf_set_termios(struct uart_port *port, struct ktermios *termios, mr2 |= MCFUART_MR2_TXCTS; } + spin_lock_irqsave(&port->lock, flags); if (port->rs485.flags & SER_RS485_ENABLED) { dev_dbg(port->dev, "Setting UART to RS485\n"); mr2 |= MCFUART_MR2_TXRTS; } - spin_lock_irqsave(&port->lock, flags); uart_update_timeout(port, termios->c_cflag, baud); writeb(MCFUART_UCR_CMDRESETRX, port->membase + MCFUART_UCR); writeb(MCFUART_UCR_CMDRESETTX, port->membase + MCFUART_UCR); @@ -442,10 +442,8 @@ static int mcf_verify_port(struct uart_port *port, struct serial_struct *ser) static int mcf_config_rs485(struct uart_port *port, struct serial_rs485 *rs485) { struct mcf_uart *pp = container_of(port, struct mcf_uart, port); - unsigned long flags; unsigned char mr1, mr2; - spin_lock_irqsave(&port->lock, flags); /* Get mode registers */ mr1 = readb(port->membase + MCFUART_UMR); mr2 = readb(port->membase + MCFUART_UMR); @@ -460,7 +458,6 @@ static int mcf_config_rs485(struct uart_port *port, struct serial_rs485 *rs485) writeb(mr1, port->membase + MCFUART_UMR); writeb(mr2, port->membase + MCFUART_UMR); port->rs485 = *rs485; - spin_unlock_irqrestore(&port->lock, flags); return 0; } |