diff options
author | Yegor Yefremov <yegorslists@googlemail.com> | 2016-04-29 10:45:07 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-05-01 13:22:54 -0700 |
commit | d11df61853f1d45035b7f5a6702c9b48d5f09a49 (patch) | |
tree | 72b6f4a87234792455eb699265b9908d946c6f9e | |
parent | fa01e2ca9f531b4a5693469a196eb1574b8d7d8a (diff) | |
download | lwn-d11df61853f1d45035b7f5a6702c9b48d5f09a49.tar.gz lwn-d11df61853f1d45035b7f5a6702c9b48d5f09a49.zip |
serial: mctrl_gpio: add IRQ locking
uart_handle_cts_change should be called with port->lock held. And for
this to be save you must also disable irqs.
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/serial_mctrl_gpio.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c index 02147361eaa9..9e1086f7f22a 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.c +++ b/drivers/tty/serial/serial_mctrl_gpio.c @@ -125,9 +125,12 @@ static irqreturn_t mctrl_gpio_irq_handle(int irq, void *context) struct uart_port *port = gpios->port; u32 mctrl = gpios->mctrl_prev; u32 mctrl_diff; + unsigned long flags; mctrl_gpio_get(gpios, &mctrl); + spin_lock_irqsave(&port->lock, flags); + mctrl_diff = mctrl ^ gpios->mctrl_prev; gpios->mctrl_prev = mctrl; @@ -147,6 +150,8 @@ static irqreturn_t mctrl_gpio_irq_handle(int irq, void *context) wake_up_interruptible(&port->state->port.delta_msr_wait); } + spin_unlock_irqrestore(&port->lock, flags); + return IRQ_HANDLED; } |