diff mbox series

[Xen-devel,v2,3/4] xen/arm: efi: Rework acpi_create_efi_mmap_table to avoid memory_map[offset]

Message ID 20170308175436.24001-4-julien.grall@arm.com
State New
Headers show
Series xen/arm: Fix and clean-up for ACPI and EFI | expand

Commit Message

Julien Grall March 8, 2017, 5:54 p.m. UTC
The code contains a lot of memory_map[offset]. This could be simplified
by incrementing the descriptor pointer every time.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

---
    Changes in v2:
        - Add Stefano's reviewed-by
---
 xen/arch/arm/efi/efi-dom0.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/xen/arch/arm/efi/efi-dom0.c b/xen/arch/arm/efi/efi-dom0.c
index f307f26bf6..f0ceaa6cae 100644
--- a/xen/arch/arm/efi/efi-dom0.c
+++ b/xen/arch/arm/efi/efi-dom0.c
@@ -112,25 +112,24 @@  void __init acpi_create_efi_mmap_table(struct domain *d,
                                        const struct meminfo *mem,
                                        struct membank tbl_add[])
 {
-    EFI_MEMORY_DESCRIPTOR *memory_map;
-    unsigned int i, offset;
+    EFI_MEMORY_DESCRIPTOR *desc;
+    unsigned int i;
     u8 *base_ptr;
 
     base_ptr = d->arch.efi_acpi_table
                + acpi_get_table_offset(tbl_add, TBL_MMAP);
-    memory_map = (EFI_MEMORY_DESCRIPTOR *)base_ptr;
+    desc = (EFI_MEMORY_DESCRIPTOR *)base_ptr;
 
-    offset = 0;
-    for( i = 0; i < mem->nr_banks; i++, offset++ )
-        fill_efi_memory_descriptor(&memory_map[offset], EfiConventionalMemory,
+    for ( i = 0; i < mem->nr_banks; i++, desc++ )
+        fill_efi_memory_descriptor(desc, EfiConventionalMemory,
                                    mem->bank[i].start, mem->bank[i].size);
 
-    for( i = 0; i < acpi_mem.nr_banks; i++, offset++ )
-        fill_efi_memory_descriptor(&memory_map[offset], EfiACPIReclaimMemory,
+    for ( i = 0; i < acpi_mem.nr_banks; i++, desc++ )
+        fill_efi_memory_descriptor(desc, EfiACPIReclaimMemory,
                                    acpi_mem.bank[i].start,
                                    acpi_mem.bank[i].size);
 
-    fill_efi_memory_descriptor(&memory_map[offset], EfiACPIReclaimMemory,
+    fill_efi_memory_descriptor(desc, EfiACPIReclaimMemory,
                                d->arch.efi_acpi_gpa, d->arch.efi_acpi_len);
 
     tbl_add[TBL_MMAP].start = d->arch.efi_acpi_gpa