Skip to content

Commit 3454a25

Browse files
ananglcarlescufi
authored andcommitted
drivers: nrf_rtc_timer: Remove unnecessary interrupt locking
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 <[email protected]>
1 parent eb0cbb4 commit 3454a25

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

drivers/timer/nrf_rtc_timer.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -424,25 +424,18 @@ static void sys_clock_timeout_handler(int32_t chan,
424424

425425
static bool channel_processing_check_and_clear(int32_t chan)
426426
{
427-
bool result = false;
428-
429-
uint32_t mcu_critical_state = full_int_lock();
430-
431427
if (nrf_rtc_int_enable_check(RTC, RTC_CHANNEL_INT_MASK(chan))) {
432428
/* The processing of channel can be caused by CC match
433429
* or be forced.
434430
*/
435-
result = (atomic_and(&force_isr_mask, ~BIT(chan)) & BIT(chan)) ||
436-
event_check(chan);
437-
438-
if (result) {
431+
if ((atomic_and(&force_isr_mask, ~BIT(chan)) & BIT(chan)) ||
432+
event_check(chan)) {
439433
event_clear(chan);
434+
return true;
440435
}
441436
}
442437

443-
full_int_unlock(mcu_critical_state);
444-
445-
return result;
438+
return false;
446439
}
447440

448441
static void process_channel(int32_t chan)

0 commit comments

Comments
 (0)