Skip to content

Commit c1f0438

Browse files
ananglrlubos
authored andcommitted
[nrf fromtree] drivers: entropy_nrf5: Eliminate direct use of WFE instructions
Use the appropriate kernel function, i.e. `k_cpu_atomic_idle()`, instead of directly executing the WFE instruction. Signed-off-by: Andrzej Głąbek <[email protected]> (cherry picked from commit 68bd036)
1 parent 93f38b2 commit c1f0438

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

drivers/entropy/entropy_nrf5.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -289,18 +289,7 @@ static int entropy_nrf5_get_entropy_isr(const struct device *dev,
289289

290290
while (!nrf_rng_event_check(NRF_RNG,
291291
NRF_RNG_EVENT_VALRDY)) {
292-
/*
293-
* To guarantee waking up from the event, the
294-
* SEV-On-Pend feature must be enabled (enabled
295-
* during ARCH initialization).
296-
*
297-
* DSB is recommended by spec before WFE (to
298-
* guarantee completion of memory transactions)
299-
*/
300-
__DSB();
301-
__WFE();
302-
__SEV();
303-
__WFE();
292+
k_cpu_atomic_idle(irq_lock());
304293
}
305294

306295
byte = random_byte_get();

0 commit comments

Comments
 (0)