x86: start annotating early ioremap pointers with __iomem
PATCH 1/1 x86: start annotating early ioremap pointers with __iomem
As with regular ioremap, iounmap etc, annotate with __iomem.
Fixes the following sparse warnings, will produce some new ones elsewhere in arch/x86 that will get worked out over time.
arch/x86/mm/ioremap.c:402:9: warning: cast removes address space of expression arch/x86/mm/ioremap.c:406:10: warning: cast adds address space to expression (<asn:2>) arch/x86/mm/ioremap.c:782:19: warning: Using plain integer as NULL pointer
Impact: some new sparse warnings in e820.c etc, but no functional change.
--- arch/x86/include/asm/io.h | 6 +++--- arch/x86/mm/ioremap.c | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-)
arch/x86/include/asm/io.h +3 -3
@@ -82,9 +82,9 @@ extern void __iomem *ioremap_wc(unsigned long offset, unsigned long size);extern void early_ioremap_init (void );extern void early_ioremap_clear (void );extern void early_ioremap_reset (void ); -extern void *early_ioremap (unsigned long offset,unsigned long size); -extern void *early_memremap (unsigned long offset,unsigned long size); -extern void early_iounmap (void *addr,unsigned long size); +extern void __iomem *early_ioremap (unsigned long offset,unsigned long size); +extern void __iomem *early_memremap (unsigned long offset,unsigned long size); +extern void early_iounmap (void __iomem *addr,unsigned long size);extern void __iomem *fix_ioremap (unsigned idx,unsigned long phys);
arch/x86/mm/ioremap.c +11 -11
@@ -387,7 +387,7 @@ static void __iomem *ioremap_default(resource_size_t phys_addr, unsigned long size) {unsigned long flags; -void *ret; +void __iomem *ret;int err;/*
@@ -399,11 +399,11 @@ static void __iomem *ioremap_default(resource_size_t phys_addr,if (err <0 )return NULL ; - ret = (void *)__ioremap_caller (phys_addr, size, flags, -__builtin_return_address (0 )); + ret =__ioremap_caller (phys_addr, size, flags, +__builtin_return_address (0 ));free_memtype (phys_addr, phys_addr + size); -return (void __iomem *)ret; +return ret; } void __iomem *ioremap_prot(resource_size_t phys_addr, unsigned long size,
@@ -622,7 +622,7 @@ static inline void __init early_clear_fixmap(enum fixed_addresses idx)__early_set_fixmap (idx,0 ,__pgprot (0 )); } -static void *prev_map[FIX_BTMAPS_SLOTS ]__initdata ; +static void __iomem *prev_map[FIX_BTMAPS_SLOTS ]__initdata ;static unsigned long prev_size[FIX_BTMAPS_SLOTS ]__initdata ;static int __init check_early_ioremap_leak (void ) {
@@ -645,7 +645,7 @@ static int __init check_early_ioremap_leak(void) }late_initcall (check_early_ioremap_leak); -static void __init *__early_ioremap (unsigned long phys_addr,unsigned long size,pgprot_t prot) +static void __init __iomem *__early_ioremap (unsigned long phys_addr,unsigned long size,pgprot_t prot) {unsigned long offset, last_addr;unsigned int nrpages;
@@ -713,23 +713,23 @@ static void __init *__early_ioremap(unsigned long phys_addr, unsigned long size,if (early_ioremap_debug)printk (KERN_CONT "%08lx + %08lx\n" , offset,fix_to_virt (idx0)); - prev_map[slot] = (void *) (offset +fix_to_virt (idx0)); + prev_map[slot] = (void __iomem *)(offset +fix_to_virt (idx0));return prev_map[slot]; }/* Remap an IO device */ -void __init *early_ioremap (unsigned long phys_addr,unsigned long size) +void __init __iomem *early_ioremap (unsigned long phys_addr,unsigned long size) {return __early_ioremap (phys_addr, size,PAGE_KERNEL_IO ); }/* Remap memory */ -void __init *early_memremap (unsigned long phys_addr,unsigned long size) +void __init __iomem *early_memremap (unsigned long phys_addr,unsigned long size) {return __early_ioremap (phys_addr, size,PAGE_KERNEL ); } -void __init early_iounmap (void *addr,unsigned long size) +void __init early_iounmap (void __iomem *addr,unsigned long size) {unsigned long virt_addr;unsigned long offset;
@@ -779,7 +779,7 @@ void __init early_iounmap(void *addr, unsigned long size) --idx; --nrpages; } - prev_map[slot] =0 ; + prev_map[slot] =NULL ; }void __this_fixmap_does_not_exist (void )
Signature · 1 line
1.6.0.3.756.gb776d
Ingo Molnar
AppliedQuoted 9 lines · Harvey Harrison
As with regular ioremap, iounmap etc, annotate with
__iomem.Fixes the following sparse warnings, will produce some new ones elsewhere in
arch/x86that will get worked out over time.
arch/x86/mm/ioremap.c:402:9: warning: cast removes address space of expressionarch/x86/mm/ioremap.c:406:10: warning: cast adds address space to expression (<asn:2>)arch/x86/mm/ioremap.c:782:19: warning: Using plain integer as NULL pointer
Quoted 7 lines
Impact: some new sparse warnings in
e820.cetc, but no functional change.Signed-off-by Harvey Harrison <[email protected]>--- arch/x86/include/asm/io.h | 6 +++--- arch/x86/mm/ioremap.c | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-)
applied to tip/x86/urgent, thanks Harvey!
Ingo