From ff2b8271439e650744818ae68a86f1d66ecbaef0 Mon Sep 17 00:00:00 2001 From: Martin Gritzan Date: Wed, 18 Oct 2023 14:02:09 +0200 Subject: [PATCH] drivers: stm32-exti: do not lock hwsem on irq disable Remove the HWSEM locking around stm32_exti_disable(). The STM32 EXTI driver uses the core-local interrupt mask regsiters on STM32H7x7 asym. dualcore MCUs. There is no need to lock the HWSEM guarding the EXTI when accessing these registers. Some sensor drivers toggle their interrupt mask every time the sensor triggers the IRQ line. Locking the HWSEM fails e.g. in situations where one coprocessor serivces the sensor and the other coprocessor sets up its interrupts initially during bootup. This prevents the sensor driver from locking the HWSEM and causes a kernel panic on the corresponding CPU. Note: The opposing stm32_exti_enable() was already correctly without locking. Signed-off-by: Martin Gritzan --- drivers/interrupt_controller/intc_exti_stm32.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/interrupt_controller/intc_exti_stm32.c b/drivers/interrupt_controller/intc_exti_stm32.c index 064d23cae20..f5f8bdc7d6e 100644 --- a/drivers/interrupt_controller/intc_exti_stm32.c +++ b/drivers/interrupt_controller/intc_exti_stm32.c @@ -73,8 +73,6 @@ void stm32_exti_enable(int line) void stm32_exti_disable(int line) { - z_stm32_hsem_lock(CFG_HW_EXTI_SEMID, HSEM_LOCK_DEFAULT_RETRY); - if (line < 32) { #if defined(CONFIG_SOC_SERIES_STM32H7X) && defined(CONFIG_CPU_CORTEX_M4) LL_C2_EXTI_DisableIT_0_31(BIT((uint32_t)line)); @@ -84,7 +82,6 @@ void stm32_exti_disable(int line) } else { __ASSERT_NO_MSG(line); } - z_stm32_hsem_unlock(CFG_HW_EXTI_SEMID); } /**