]> xenbits.xensource.com Git - seabios.git/commitdiff
pciinit: Simplify list manipulation in pci_region_migrate_64bit_entries.
authorKevin O'Connor <kevin@koconnor.net>
Fri, 27 Apr 2012 02:20:56 +0000 (22:20 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Fri, 27 Apr 2012 02:20:56 +0000 (22:20 -0400)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/pciinit.c

index c288fe7fb17680e313900fa14b5dda2fe2cd4c1d..dbbcf0768c86f30d2551e08a5cf3ca0ea45293ab 100644 (file)
@@ -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;
     }
 }