Skip to content

Commit

Permalink
drivers: nrf_rtc_timer: Remove unnecessary locking
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
anangl authored and nashif committed May 25, 2021
1 parent 59b21a2 commit 457a28b
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions drivers/timer/nrf_rtc_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 457a28b

Please sign in to comment.