cpu/x86: Use do while loop

With the do while loop, it can be avoided do use an infinite loop with a
break condition inside.

Change-Id: I030f6782ad618b55112a2f0bac8dda08b497a9f1
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-on: https://review.coreboot.org/20269
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Paul Menzel 2017-06-19 13:02:31 +02:00 committed by Martin Roth
parent 2721e1fab7
commit 6bb8ff4637
1 changed files with 2 additions and 5 deletions

View File

@ -891,7 +891,7 @@ static int run_ap_work(mp_callback_t func, long expire_us)
/* Wait for all the APs to signal back that call has been accepted. */ /* Wait for all the APs to signal back that call has been accepted. */
stopwatch_init_usecs_expire(&sw, expire_us); stopwatch_init_usecs_expire(&sw, expire_us);
while (1) { do {
cpus_accepted = 0; cpus_accepted = 0;
for (i = 0; i < ARRAY_SIZE(ap_callbacks); i++) { for (i = 0; i < ARRAY_SIZE(ap_callbacks); i++) {
@ -903,10 +903,7 @@ static int run_ap_work(mp_callback_t func, long expire_us)
if (cpus_accepted == global_num_aps) if (cpus_accepted == global_num_aps)
return 0; return 0;
} while (!stopwatch_expired(&sw));
if (stopwatch_expired(&sw))
break;
}
printk(BIOS_ERR, "AP call expired. %d/%d CPUs accepted.\n", printk(BIOS_ERR, "AP call expired. %d/%d CPUs accepted.\n",
cpus_accepted, global_num_aps); cpus_accepted, global_num_aps);