Skip to content

Commit

Permalink
serial: trim locking on the helpers
Browse files Browse the repository at this point in the history
The port mutex protects port->tty, but these paths never need to walk from
port->tty. They do need the low level lock as the API expects that but they
already also take it.

Thus we can drop the extra mutex lock calls here.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alan Cox authored and Greg Kroah-Hartman committed Aug 10, 2010
1 parent de0c8cb commit 24fcc7c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/serial/serial_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1506,12 +1506,10 @@ static int uart_carrier_raised(struct tty_port *port)
struct uart_state *state = container_of(port, struct uart_state, port);
struct uart_port *uport = state->uart_port;
int mctrl;
mutex_lock(&port->mutex);
spin_lock_irq(&uport->lock);
uport->ops->enable_ms(uport);
mctrl = uport->ops->get_mctrl(uport);
spin_unlock_irq(&uport->lock);
mutex_unlock(&port->mutex);
if (mctrl & TIOCM_CAR)
return 1;
return 0;
Expand All @@ -1521,12 +1519,11 @@ static void uart_dtr_rts(struct tty_port *port, int onoff)
{
struct uart_state *state = container_of(port, struct uart_state, port);
struct uart_port *uport = state->uart_port;
mutex_lock(&port->mutex);

if (onoff)
uart_set_mctrl(uport, TIOCM_DTR | TIOCM_RTS);
else
uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS);
mutex_unlock(&port->mutex);
}

/*
Expand Down

0 comments on commit 24fcc7c

Please sign in to comment.