From d630d14e75a1af4360808d82107b6006d2d4e48e Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 26 Apr 2012 22:20:56 -0400 Subject: [PATCH] pciinit: Simplify list manipulation in pci_region_migrate_64bit_entries. Signed-off-by: Kevin O'Connor --- src/pciinit.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) 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; } } -- 2.39.5