]> asedeno.scripts.mit.edu Git - linux.git/commit
irqchip/stm32: protect configuration registers with hwspinlock
authorBenjamin Gaignard <benjamin.gaignard@st.com>
Mon, 17 Dec 2018 14:22:14 +0000 (15:22 +0100)
committerMarc Zyngier <marc.zyngier@arm.com>
Tue, 18 Dec 2018 15:38:31 +0000 (15:38 +0000)
commitfb94109b764e7676fa63834b9033ba97175877a0
treebff2fc426cce4fb2ef34387358bde655bb901457
parent897898a69451dc31950d200c0fcdba24428a6482
irqchip/stm32: protect configuration registers with hwspinlock

If a hwspinlock is defined in device tree use it to protect
configuration registers.

Do not request for hwspinlock during the exti driver init since the
hwspinlock driver is not probed yet at that stage and the exti driver
does not support deferred probe.
Instead of this, postpone the hwspinlock request at the first time the
hwspinlock is actually needed.

Use the hwspin_trylock_raw() API which is the most appropriated here
Indeed:
- hwspin_lock_() calls are under spin_lock protection (chip_data->rlock
  or gc->lock).
- the _timeout() API relies on jiffies count which won't work if IRQs
  are disabled which is the case here (a large part of the IRQ setup is
  done atomically (see irq/manage.c))
As a consequence implement the retry/timeout lock from here. And since
all of this is done atomically, reduce the timeout delay to 1 ms.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
drivers/irqchip/irq-stm32-exti.c