CHECK_NMI_SAFE_CMPXCHG();
entry = head->first;
- do {
+ for (;;) {
old_entry = entry;
new->next = entry;
+ entry = cmpxchg(&head->first, old_entry, new);
+ if (entry == old_entry)
+ break;
cpu_relax();
- } while ((entry = cmpxchg(&head->first, old_entry, new)) != old_entry);
+ }
}
/**
CHECK_NMI_SAFE_CMPXCHG();
entry = head->first;
- do {
+ for (;;) {
old_entry = entry;
new_last->next = entry;
+ entry = cmpxchg(&head->first, old_entry, new_first);
+ if (entry == old_entry)
+ break;
cpu_relax();
- } while ((entry = cmpxchg(&head->first, old_entry, new_first)) != old_entry);
+ }
}
/**
CHECK_NMI_SAFE_CMPXCHG();
entry = head->first;
- do {
+ for (;;) {
if (entry == NULL)
return NULL;
old_entry = entry;
next = entry->next;
+ entry = cmpxchg(&head->first, old_entry, next);
+ if (entry == old_entry)
+ break;
cpu_relax();
- } while ((entry = cmpxchg(&head->first, old_entry, next)) != old_entry);
+ }
return entry;
}