Skip to content

Commit 457a28b

Browse files
ananglnashif
authored andcommitted
drivers: nrf_rtc_timer: Remove unnecessary locking
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 <[email protected]>
1 parent 59b21a2 commit 457a28b

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

drivers/timer/nrf_rtc_timer.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -386,11 +386,7 @@ uint32_t sys_clock_elapsed(void)
386386
return 0;
387387
}
388388

389-
k_spinlock_key_t key = k_spin_lock(&lock);
390-
uint32_t ret = counter_sub(counter(), last_count) / CYC_PER_TICK;
391-
392-
k_spin_unlock(&lock, key);
393-
return ret;
389+
return counter_sub(counter(), last_count) / CYC_PER_TICK;
394390
}
395391

396392
uint32_t sys_clock_cycle_get_32(void)

0 commit comments

Comments
 (0)