From 457a28bf78a4cdd2b17f3983c50a0183f2f71700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 24 May 2021 11:46:07 +0200 Subject: [PATCH] drivers: nrf_rtc_timer: Remove unnecessary locking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As per description of the sys_clock_elapsed() function, "the kernel will call this with appropriate locking, the driver needs only provide an instantaneous answer". Remove then the unnecessary locking from the function, as it only adds an undesirable delay. Signed-off-by: Andrzej Głąbek --- drivers/timer/nrf_rtc_timer.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/timer/nrf_rtc_timer.c b/drivers/timer/nrf_rtc_timer.c index 38b31671e44108..fb5af5f08a2188 100644 --- a/drivers/timer/nrf_rtc_timer.c +++ b/drivers/timer/nrf_rtc_timer.c @@ -386,11 +386,7 @@ uint32_t sys_clock_elapsed(void) return 0; } - k_spinlock_key_t key = k_spin_lock(&lock); - uint32_t ret = counter_sub(counter(), last_count) / CYC_PER_TICK; - - k_spin_unlock(&lock, key); - return ret; + return counter_sub(counter(), last_count) / CYC_PER_TICK; } uint32_t sys_clock_cycle_get_32(void)