]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
x86/fixmap: Modify fix_to_virt() to return a void pointer
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 11 Jan 2018 17:48:00 +0000 (17:48 +0000)
committerRoger Pau Monne <roger.pau@citrix.com>
Thu, 11 Jan 2018 17:51:18 +0000 (17:51 +0000)
Almost all users of fix_to_virt() actually want a pointer.  Include the cast
within the definition, so the callers don't need to.

Two users which need the integer value are switched to using __fix_to_virt()
directly.  A few users stay fully unchanged, due to GCC's void pointer
arithmetic extension causing the same behaviour.  Most users however have
their explicit casting dropped.

Since __iomem is not used consistently in Xen, we drop it too.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
v2: update commit message and remove unnecessary parentheses.

xen/arch/x86/acpi/lib.c
xen/arch/x86/mm.c
xen/arch/x86/mpparse.c
xen/arch/x86/msi.c
xen/arch/x86/tboot.c
xen/drivers/acpi/apei/apei-io.c
xen/drivers/char/ehci-dbgp.c
xen/drivers/char/ns16550.c
xen/include/asm-x86/apicdef.h
xen/include/asm-x86/fixmap.h

index 7d7c71848bc5987eebd0759e126bbcda0781206b..265b9ad8190562ad323e2e9d5f07cb3e69444b17 100644 (file)
@@ -49,7 +49,7 @@ char *__acpi_map_table(paddr_t phys, unsigned long size)
        offset = phys & (PAGE_SIZE - 1);
        mapped_size = PAGE_SIZE - offset;
        set_fixmap(FIX_ACPI_END, phys);
-       base = fix_to_virt(FIX_ACPI_END);
+       base = __fix_to_virt(FIX_ACPI_END);
 
        /*
         * Most cases can be covered by the below.
index a7a76a71db7cfd2948d90f7ef8dfbbedf9665ff4..0569342200d87c6631eae6d286513394ce5c7ff3 100644 (file)
@@ -5205,12 +5205,12 @@ void __set_fixmap(
     enum fixed_addresses idx, unsigned long mfn, unsigned long flags)
 {
     BUG_ON(idx >= __end_of_fixed_addresses);
-    map_pages_to_xen(fix_to_virt(idx), mfn, 1, flags);
+    map_pages_to_xen(__fix_to_virt(idx), mfn, 1, flags);
 }
 
 void *__init arch_vmap_virt_end(void)
 {
-    return (void *)fix_to_virt(__end_of_fixed_addresses);
+    return fix_to_virt(__end_of_fixed_addresses);
 }
 
 void __iomem *ioremap(paddr_t pa, size_t len)
index a1a0738a19c082c3078bd210df5b11c4c84fa459..49140e46f0375053b84ee1c1a25651d47cf9f266 100644 (file)
@@ -703,7 +703,7 @@ static void __init efi_check_config(void)
                return;
 
        __set_fixmap(FIX_EFI_MPF, PFN_DOWN(efi.mps), __PAGE_HYPERVISOR);
-       mpf = (void *)fix_to_virt(FIX_EFI_MPF) + ((long)efi.mps & (PAGE_SIZE-1));
+       mpf = fix_to_virt(FIX_EFI_MPF) + ((long)efi.mps & (PAGE_SIZE-1));
 
        if (memcmp(mpf->mpf_signature, "_MP_", 4) == 0 &&
            mpf->mpf_length == 1 &&
index 4652b98c2d95c63653a0f36fbfd17c06c5cc4953..475881ed89f444ff01a8758b151afeab1c343e40 100644 (file)
@@ -961,8 +961,7 @@ static int msix_capability_init(struct pci_dev *dev,
             xfree(entry);
             return idx;
         }
-        base = (void *)(fix_to_virt(idx) +
-                        ((unsigned long)entry_paddr & (PAGE_SIZE - 1)));
+        base = fix_to_virt(idx) + (entry_paddr & (PAGE_SIZE - 1));
 
         /* Mask interrupt here */
         writel(1, base + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
index 59d7c477f42565dc7a7bf342b6d4ed49f7ed1626..d36bf33407e5decdfe562c138233883ae76844ab 100644 (file)
@@ -82,7 +82,7 @@ static void __init tboot_copy_memory(unsigned char *va, uint32_t size,
         {
             map_base = PFN_DOWN(pa + i);
             set_fixmap(FIX_TBOOT_MAP_ADDRESS, map_base << PAGE_SHIFT);
-            map_addr = (unsigned char *)fix_to_virt(FIX_TBOOT_MAP_ADDRESS);
+            map_addr = fix_to_virt(FIX_TBOOT_MAP_ADDRESS);
         }
         va[i] = map_addr[pa + i - (map_base << PAGE_SHIFT)];
     }
@@ -98,7 +98,7 @@ void __init tboot_probe(void)
 
     /* Map and check for tboot UUID. */
     set_fixmap(FIX_TBOOT_SHARED_BASE, opt_tboot_pa);
-    tboot_shared = (tboot_shared_t *)fix_to_virt(FIX_TBOOT_SHARED_BASE);
+    tboot_shared = fix_to_virt(FIX_TBOOT_SHARED_BASE);
     if ( tboot_shared == NULL )
         return;
     if ( memcmp(&tboot_shared_uuid, (uuid_t *)tboot_shared, sizeof(uuid_t)) )
index 8955de935e3a93c839700b6abcc8a507f67d5e99..89b70f45ef47df3ba076f42b37da116ad050951c 100644 (file)
@@ -92,7 +92,7 @@ static void __iomem *__init apei_range_map(paddr_t paddr, unsigned long size)
                apei_range_nr++;
        }
 
-       return (void __iomem *)fix_to_virt(FIX_APEI_RANGE_BASE + start_nr);
+       return fix_to_virt(FIX_APEI_RANGE_BASE + start_nr);
 }
 
 /*
index d48e777c3438d21ff57b8d786b7e691d4374c4c0..d0071d3114a9a826f37b89da1fcfafdbff523ac8 100644 (file)
@@ -1327,7 +1327,7 @@ static void __init ehci_dbgp_init_preirq(struct serial_port *port)
      * than enough.  1k is the biggest that was seen.
      */
     set_fixmap_nocache(FIX_EHCI_DBGP, dbgp->bar_val);
-    ehci_bar = (void __iomem *)fix_to_virt(FIX_EHCI_DBGP);
+    ehci_bar = fix_to_virt(FIX_EHCI_DBGP);
     ehci_bar += dbgp->bar_val & ~PAGE_MASK;
     dbgp_printk("ehci_bar: %p\n", ehci_bar);
 
index e0f8199f9833f44b51ec1e0f03d08fb6ff972cdb..f32dbd324798c4450d8c99bd0b0cd4c593ea2eee 100644 (file)
@@ -697,7 +697,7 @@ static void __init ns16550_init_preirq(struct serial_port *port)
         enum fixed_addresses idx = FIX_COM_BEGIN + (uart - ns16550_com);
 
         set_fixmap_nocache(idx, uart->io_base);
-        uart->remapped_io_base = (void __iomem *)fix_to_virt(idx);
+        uart->remapped_io_base = fix_to_virt(idx);
         uart->remapped_io_base += uart->io_base & ~PAGE_MASK;
 #else
         uart->remapped_io_base = (char *)ioremap(uart->io_base, uart->io_size);
index eed504a31a2c6528a3204bd3fd3fdd75b53d1753..2fa0b77a8a248fcaff0bf591a4d533707f426e58 100644 (file)
 /* Only available in x2APIC mode */
 #define                APIC_SELF_IPI   0x3F0
 
-#define APIC_BASE (fix_to_virt(FIX_APIC_BASE))
+#define APIC_BASE __fix_to_virt(FIX_APIC_BASE)
 
 /* It's only used in x2APIC mode of an x2APIC unit. */
 #define APIC_MSR_BASE 0x800
index 89bf6cb611efbca1ee88da194ce27a70e2b3f3ad..51b0e7e94542da22d5a57f014943829de6300923 100644 (file)
@@ -79,7 +79,7 @@ extern void __set_fixmap(
 #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
 #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
 
-#define fix_to_virt(x)   (__fix_to_virt(x))
+#define fix_to_virt(x)   ((void *)__fix_to_virt(x))
 
 static inline unsigned long virt_to_fix(const unsigned long vaddr)
 {