summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorAnson Huang <Anson.Huang@nxp.com>2018-08-24 14:17:58 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:33:31 +0800
commit515c57466880aaa84e72423d3385b9744a45156c (patch)
treedb2a69229a4192119810a9ec9d249dbf92540a9c /drivers/gpio
parent0cf1c6e5ea06f840ddb5b981253686e46b1a1b7e (diff)
MLK-19326 gpio: mxc: fix possible race condition for PAD wakeup
This patch adds line 0 PAD wakeup support, it is missed previously, also protect the PAD wakeup interrupt handle with spin lock to avoid possible race condition of GPIO interrupt arriving during PAD wakeup interrupt handling. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Fugang Duan <fugang.duan@nxp.com> (cherry picked from commit db842471137ef2758de6192f8f400e4b56da5d01)
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-mxc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index dd79d41d2614..d63064f10c0c 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -831,12 +831,11 @@ static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
writel(port->suspend_saved_reg[3], port->base + GPIO_GDIR);
writel(port->suspend_saved_reg[4], port->base + GPIO_EDGE_SEL);
writel(port->suspend_saved_reg[5], port->base + GPIO_DR);
- spin_unlock_irqrestore(&port->gc.bgpio_lock, flags);
-
#ifdef CONFIG_GPIO_MXC_PAD_WAKEUP
- if (wakeup_line > 0)
+ if (wakeup_line >= 0)
mxc_gpio_handle_pad_wakeup(port, wakeup_line);
#endif
+ spin_unlock_irqrestore(&port->gc.bgpio_lock, flags);
clk_disable_unprepare(port->clk);
return 0;