summaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-02-04 16:48:05 +0100
committerIngo Molnar <mingo@elte.hu>2008-02-04 16:48:05 +0100
commite66aadbe6cb90813b3bbf07e3bc2a6aedcef7cd1 (patch)
treeae186137ded635db61277066779976d6673d85a0 /arch/x86
parent63c1dcf4bc9a26b1d8baa9a8c7cc1b2e1e694011 (diff)
downloadop-kernel-dev-e66aadbe6cb90813b3bbf07e3bc2a6aedcef7cd1.zip
op-kernel-dev-e66aadbe6cb90813b3bbf07e3bc2a6aedcef7cd1.tar.gz
x86: simplify __ioremap
Remove tons of castings which make the code hard to read. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/mm/ioremap.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 1a88d15..2c3fa71 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -114,9 +114,8 @@ static int ioremap_change_attr(unsigned long paddr, unsigned long size,
static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
enum ioremap_mode mode)
{
- void __iomem *addr;
+ unsigned long pfn, offset, last_addr, vaddr;
struct vm_struct *area;
- unsigned long pfn, offset, last_addr;
pgprot_t prot;
/* Don't allow wraparound or zero size */
@@ -164,19 +163,18 @@ static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
if (!area)
return NULL;
area->phys_addr = phys_addr;
- addr = (void __iomem *) area->addr;
- if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size,
- phys_addr, prot)) {
- remove_vm_area((void *)(PAGE_MASK & (unsigned long) addr));
+ vaddr = (unsigned long) area->addr;
+ if (ioremap_page_range(vaddr, vaddr + size, phys_addr, prot)) {
+ remove_vm_area((void *)(vaddr & PAGE_MASK));
return NULL;
}
if (ioremap_change_attr(phys_addr, size, mode) < 0) {
- vunmap(addr);
+ vunmap(area->addr);
return NULL;
}
- return (void __iomem *) (offset + (char __iomem *)addr);
+ return (void __iomem *) (vaddr + offset);
}
/**
OpenPOWER on IntegriCloud