From 3454a2547ead7f867c75cf83b12a38a6ea4dc599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 4 Jan 2023 15:08:38 +0100 Subject: [PATCH] drivers: nrf_rtc_timer: Remove unnecessary interrupt locking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no need to disable interrupts while just checking if a channel needs to be processed in the ISR, as that section does not contain anything that needs to be protected against overwriting from some other context. In particular, if a given timeout is changed or even aborted while its event is being checked, this will be correctly handled in the code that follows and that checks the expiration time. Signed-off-by: Andrzej Głąbek --- drivers/timer/nrf_rtc_timer.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/timer/nrf_rtc_timer.c b/drivers/timer/nrf_rtc_timer.c index 03398848c8e..ecff65c8c60 100644 --- a/drivers/timer/nrf_rtc_timer.c +++ b/drivers/timer/nrf_rtc_timer.c @@ -424,25 +424,18 @@ static void sys_clock_timeout_handler(int32_t chan, static bool channel_processing_check_and_clear(int32_t chan) { - bool result = false; - - uint32_t mcu_critical_state = full_int_lock(); - if (nrf_rtc_int_enable_check(RTC, RTC_CHANNEL_INT_MASK(chan))) { /* The processing of channel can be caused by CC match * or be forced. */ - result = (atomic_and(&force_isr_mask, ~BIT(chan)) & BIT(chan)) || - event_check(chan); - - if (result) { + if ((atomic_and(&force_isr_mask, ~BIT(chan)) & BIT(chan)) || + event_check(chan)) { event_clear(chan); + return true; } } - full_int_unlock(mcu_critical_state); - - return result; + return false; } static void process_channel(int32_t chan)