From: Kevin O'Connor Date: Fri, 27 Apr 2012 02:20:56 +0000 (-0400) Subject: pciinit: Simplify list manipulation in pci_region_migrate_64bit_entries. X-Git-Tag: rel-1.7.1~76 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d630d14e75a1af4360808d82107b6006d2d4e48e;p=seabios.git pciinit: Simplify list manipulation in pci_region_migrate_64bit_entries. Signed-off-by: Kevin O'Connor --- diff --git a/src/pciinit.c b/src/pciinit.c index c288fe7..dbbcf07 100644 --- a/src/pciinit.c +++ b/src/pciinit.c @@ -389,21 +389,18 @@ static u64 pci_region_sum(struct pci_region *r) static void pci_region_migrate_64bit_entries(struct pci_region *from, struct pci_region *to) { - struct pci_region_entry **pprev = &from->list; - struct pci_region_entry **last = &to->list; + struct pci_region_entry **pprev = &from->list, **last = &to->list; while (*pprev) { - if ((*pprev)->is64) { - struct pci_region_entry *entry; - entry = *pprev; - /* Delete the entry and move next */ - *pprev = (*pprev)->next; - /* Add entry at tail to keep a sorted order */ - entry->next = NULL; - *last = entry; - last = &entry->next; + struct pci_region_entry *entry = *pprev; + if (!entry->is64) { + pprev = &entry->next; + continue; } - else - pprev = &(*pprev)->next; + // Move from source list to destination list. + *pprev = entry->next; + entry->next = NULL; + *last = entry; + last = &entry->next; } }