diff --git a/applications/firmware_loader/ble_mcumgr/src/main.c b/applications/firmware_loader/ble_mcumgr/src/main.c index e77d764929..d2de4c85b4 100644 --- a/applications/firmware_loader/ble_mcumgr/src/main.c +++ b/applications/firmware_loader/ble_mcumgr/src/main.c @@ -310,12 +310,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } if (device_disconnected == false) { diff --git a/applications/firmware_loader/uart_mcumgr/src/main.c b/applications/firmware_loader/uart_mcumgr/src/main.c index 2a29a0236c..d8faa87b76 100644 --- a/applications/firmware_loader/uart_mcumgr/src/main.c +++ b/applications/firmware_loader/uart_mcumgr/src/main.c @@ -51,12 +51,7 @@ int main(void) mgmt_callback_register(&os_mgmt_reboot_callback); while (should_reboot == false) { - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); smp_uart_process_rx_queue(); } diff --git a/lib/bluetooth/peer_manager/modules/peer_data_storage.c b/lib/bluetooth/peer_manager/modules/peer_data_storage.c index 4d94a891ee..04ae9341a2 100644 --- a/lib/bluetooth/peer_manager/modules/peer_data_storage.c +++ b/lib/bluetooth/peer_manager/modules/peer_data_storage.c @@ -280,12 +280,7 @@ static void bm_zms_evt_handler(const struct bm_zms_evt *evt) static void wait_for_init(void) { while (!fs.init_flags.initialized) { - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } } diff --git a/samples/bluetooth/ble_bms/src/main.c b/samples/bluetooth/ble_bms/src/main.c index d412393171..0f38f66ef6 100644 --- a/samples/bluetooth/ble_bms/src/main.c +++ b/samples/bluetooth/ble_bms/src/main.c @@ -733,12 +733,7 @@ int main(void) /* Empty. */ } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/bluetooth/ble_cgms/src/main.c b/samples/bluetooth/ble_cgms/src/main.c index bca4759aca..c249d135ae 100644 --- a/samples/bluetooth/ble_cgms/src/main.c +++ b/samples/bluetooth/ble_cgms/src/main.c @@ -1028,12 +1028,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/bluetooth/ble_hids_keyboard/src/main.c b/samples/bluetooth/ble_hids_keyboard/src/main.c index 265915408c..bd07b201f2 100644 --- a/samples/bluetooth/ble_hids_keyboard/src/main.c +++ b/samples/bluetooth/ble_hids_keyboard/src/main.c @@ -1005,12 +1005,7 @@ int main(void) /* Empty. */ } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/bluetooth/ble_hids_mouse/src/main.c b/samples/bluetooth/ble_hids_mouse/src/main.c index aa58193263..5b8dab9291 100644 --- a/samples/bluetooth/ble_hids_mouse/src/main.c +++ b/samples/bluetooth/ble_hids_mouse/src/main.c @@ -846,12 +846,7 @@ int main(void) /* Empty. */ } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/bluetooth/ble_hrs/src/main.c b/samples/bluetooth/ble_hrs/src/main.c index 2242bc579e..7e1711c9f4 100644 --- a/samples/bluetooth/ble_hrs/src/main.c +++ b/samples/bluetooth/ble_hrs/src/main.c @@ -554,12 +554,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/bluetooth/ble_hrs_central/src/main.c b/samples/bluetooth/ble_hrs_central/src/main.c index be8dd0a789..420070828e 100644 --- a/samples/bluetooth/ble_hrs_central/src/main.c +++ b/samples/bluetooth/ble_hrs_central/src/main.c @@ -664,11 +664,6 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } } diff --git a/samples/bluetooth/ble_lbs/src/main.c b/samples/bluetooth/ble_lbs/src/main.c index e2d64beaa9..53f7cb3c63 100644 --- a/samples/bluetooth/ble_lbs/src/main.c +++ b/samples/bluetooth/ble_lbs/src/main.c @@ -225,12 +225,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/bluetooth/ble_nus/src/main.c b/samples/bluetooth/ble_nus/src/main.c index 73fa178cf6..58da8caa56 100644 --- a/samples/bluetooth/ble_nus/src/main.c +++ b/samples/bluetooth/ble_nus/src/main.c @@ -559,12 +559,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/bluetooth/ble_pwr_profiling/src/main.c b/samples/bluetooth/ble_pwr_profiling/src/main.c index c83eb250a2..4beb9aa101 100644 --- a/samples/bluetooth/ble_pwr_profiling/src/main.c +++ b/samples/bluetooth/ble_pwr_profiling/src/main.c @@ -722,12 +722,7 @@ int main(void) /* Empty. */ } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/bluetooth/ble_radio_notification/src/main.c b/samples/bluetooth/ble_radio_notification/src/main.c index 1b224ac894..ef8d3a53c8 100644 --- a/samples/bluetooth/ble_radio_notification/src/main.c +++ b/samples/bluetooth/ble_radio_notification/src/main.c @@ -135,12 +135,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/bluetooth/hello_softdevice/src/main.c b/samples/bluetooth/hello_softdevice/src/main.c index f2e4c197a9..3f04bf74a7 100644 --- a/samples/bluetooth/hello_softdevice/src/main.c +++ b/samples/bluetooth/hello_softdevice/src/main.c @@ -75,12 +75,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/boot/mcuboot_recovery_entry/src/main.c b/samples/boot/mcuboot_recovery_entry/src/main.c index a826d8fe39..86c8568e90 100644 --- a/samples/boot/mcuboot_recovery_entry/src/main.c +++ b/samples/boot/mcuboot_recovery_entry/src/main.c @@ -232,12 +232,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } if (device_disconnected == false) { diff --git a/samples/nfc/record_text_t2t/src/main.c b/samples/nfc/record_text_t2t/src/main.c index 8814924e21..efd9ae127a 100644 --- a/samples/nfc/record_text_t2t/src/main.c +++ b/samples/nfc/record_text_t2t/src/main.c @@ -211,12 +211,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/nfc/record_text_t4t/src/main.c b/samples/nfc/record_text_t4t/src/main.c index 613b655f20..e870be4142 100644 --- a/samples/nfc/record_text_t4t/src/main.c +++ b/samples/nfc/record_text_t4t/src/main.c @@ -221,12 +221,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/peripherals/buttons/src/main.c b/samples/peripherals/buttons/src/main.c index 3313b88950..9e2971d8e1 100644 --- a/samples/peripherals/buttons/src/main.c +++ b/samples/peripherals/buttons/src/main.c @@ -75,12 +75,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } err = bm_buttons_deinit(); @@ -96,12 +91,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/peripherals/lpuarte/src/main.c b/samples/peripherals/lpuarte/src/main.c index ea6e0bc68b..8a0a4221e6 100644 --- a/samples/peripherals/lpuarte/src/main.c +++ b/samples/peripherals/lpuarte/src/main.c @@ -176,12 +176,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } /* Unreachable */ diff --git a/samples/peripherals/pwm/src/main.c b/samples/peripherals/pwm/src/main.c index da142f3cee..7c4413a0a2 100644 --- a/samples/peripherals/pwm/src/main.c +++ b/samples/peripherals/pwm/src/main.c @@ -73,12 +73,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/peripherals/timer/src/main.c b/samples/peripherals/timer/src/main.c index c84a56cb2d..756114aea2 100644 --- a/samples/peripherals/timer/src/main.c +++ b/samples/peripherals/timer/src/main.c @@ -104,12 +104,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/peripherals/uarte/src/main.c b/samples/peripherals/uarte/src/main.c index 4f66406fd5..a7e12f8a6b 100644 --- a/samples/peripherals/uarte/src/main.c +++ b/samples/peripherals/uarte/src/main.c @@ -158,12 +158,7 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/subsys/fs/bm_zms/src/main.c b/samples/subsys/fs/bm_zms/src/main.c index e66af18962..b90f83e53c 100644 --- a/samples/subsys/fs/bm_zms/src/main.c +++ b/samples/subsys/fs/bm_zms/src/main.c @@ -65,12 +65,7 @@ void bm_zms_sample_handler(struct bm_zms_evt const *evt) static void wait_for_write(void) { while (!write_notif) { - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } write_notif = false; } @@ -78,12 +73,7 @@ static void wait_for_write(void) static void wait_for_mount(void) { while (!mount_notif) { - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } mount_notif = false; } @@ -91,12 +81,7 @@ static void wait_for_mount(void) static void wait_for_clear(void) { while (!clear_notif) { - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } clear_notif = false; } @@ -358,12 +343,7 @@ int main(void) /* Empty. */ } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } return 0; diff --git a/samples/subsys/storage/bm_storage/src/main.c b/samples/subsys/storage/bm_storage/src/main.c index 274a3912e7..44abcdf913 100644 --- a/samples/subsys/storage/bm_storage/src/main.c +++ b/samples/subsys/storage/bm_storage/src/main.c @@ -79,12 +79,7 @@ static void wait_for_outstanding_writes(void) { LOG_INF("Waiting for writes to complete..."); while (outstanding_writes > 0) { - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } } @@ -291,11 +286,6 @@ int main(void) while (LOG_PROCESS()) { } - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } } diff --git a/tests/subsys/fs/bm_zms/src/main.c b/tests/subsys/fs/bm_zms/src/main.c index 7817911786..3ba6b44771 100644 --- a/tests/subsys/fs/bm_zms/src/main.c +++ b/tests/subsys/fs/bm_zms/src/main.c @@ -55,12 +55,7 @@ static void wait_for_write(void) k_sem_take(&write_sem, K_FOREVER); #elif defined(CONFIG_SOFTDEVICE) while (!write_notif) { - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } write_notif = false; #endif @@ -72,12 +67,7 @@ static void wait_for_mount(void) k_sem_take(&mount_sem, K_FOREVER); #elif defined(CONFIG_SOFTDEVICE) while (!is_init) { - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } #endif } @@ -88,12 +78,7 @@ static void wait_for_clear(void) k_sem_take(&clear_sem, K_FOREVER); #elif defined(CONFIG_SOFTDEVICE) while (fs_is_init) { - /* Wait for an event. */ - __WFE(); - - /* Clear Event Register */ - __SEV(); - __WFE(); + k_cpu_idle(); } #endif }