* [PATCH v1 1/1] pinctrl: intel: Protect set wake flow by spin lock
@ 2016-07-08 11:30 Andy Shevchenko
2016-07-08 11:59 ` Mika Westerberg
2016-07-11 9:16 ` Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2016-07-08 11:30 UTC (permalink / raw)
To: Mika Westerberg, linux-gpio, Linus Walleij; +Cc: Andy Shevchenko
It seems intel_gpio_irq_wake() misses lock protection against I/O flow.
Use spin lock here as well.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/intel/pinctrl-intel.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index fe19b1e..257cab1 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -796,12 +796,15 @@ static int intel_gpio_irq_wake(struct irq_data *d, unsigned int on)
const struct intel_community *community;
unsigned pin = irqd_to_hwirq(d);
unsigned padno, gpp, gpp_offset;
+ unsigned long flags;
u32 gpe_en;
community = intel_get_community(pctrl, pin);
if (!community)
return -EINVAL;
+ raw_spin_lock_irqsave(&pctrl->lock, flags);
+
padno = pin_to_padno(community, pin);
gpp = padno / community->gpp_size;
gpp_offset = padno % community->gpp_size;
@@ -821,6 +824,8 @@ static int intel_gpio_irq_wake(struct irq_data *d, unsigned int on)
gpe_en &= ~BIT(gpp_offset);
writel(gpe_en, community->regs + GPI_GPE_EN + gpp * 4);
+ raw_spin_unlock_irqrestore(&pctrl->lock, flags);
+
dev_dbg(pctrl->dev, "%sable wake for pin %u\n", on ? "en" : "dis", pin);
return 0;
}
--
2.8.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] pinctrl: intel: Protect set wake flow by spin lock
2016-07-08 11:30 [PATCH v1 1/1] pinctrl: intel: Protect set wake flow by spin lock Andy Shevchenko
@ 2016-07-08 11:59 ` Mika Westerberg
2016-07-11 9:16 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Mika Westerberg @ 2016-07-08 11:59 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-gpio, Linus Walleij
On Fri, Jul 08, 2016 at 02:30:46PM +0300, Andy Shevchenko wrote:
> It seems intel_gpio_irq_wake() misses lock protection against I/O flow.
> Use spin lock here as well.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] pinctrl: intel: Protect set wake flow by spin lock
2016-07-08 11:30 [PATCH v1 1/1] pinctrl: intel: Protect set wake flow by spin lock Andy Shevchenko
2016-07-08 11:59 ` Mika Westerberg
@ 2016-07-11 9:16 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2016-07-11 9:16 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Mika Westerberg, linux-gpio
On Fri, Jul 8, 2016 at 1:30 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> It seems intel_gpio_irq_wake() misses lock protection against I/O flow.
> Use spin lock here as well.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Patch applied with Mika's ACK.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-11 9:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-08 11:30 [PATCH v1 1/1] pinctrl: intel: Protect set wake flow by spin lock Andy Shevchenko
2016-07-08 11:59 ` Mika Westerberg
2016-07-11 9:16 ` Linus Walleij
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.