aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-02-04 10:48:05 -0500
committerIngo Molnar <mingo@elte.hu>2008-02-04 10:48:05 -0500
commite66aadbe6cb90813b3bbf07e3bc2a6aedcef7cd1 (patch)
treeae186137ded635db61277066779976d6673d85a0 /arch/x86
parent63c1dcf4bc9a26b1d8baa9a8c7cc1b2e1e694011 (diff)
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 1a88d1572a77..2c3fa7189503 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,
114static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, 114static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
115 enum ioremap_mode mode) 115 enum ioremap_mode mode)
116{ 116{
117 void __iomem *addr; 117 unsigned long pfn, offset, last_addr, vaddr;
118 struct vm_struct *area; 118 struct vm_struct *area;
119 unsigned long pfn, offset, last_addr;
120 pgprot_t prot; 119 pgprot_t prot;
121 120
122 /* Don't allow wraparound or zero size */ 121 /* Don't allow wraparound or zero size */
@@ -164,19 +163,18 @@ static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
164 if (!area) 163 if (!area)
165 return NULL; 164 return NULL;
166 area->phys_addr = phys_addr; 165 area->phys_addr = phys_addr;
167 addr = (void __iomem *) area->addr; 166 vaddr = (unsigned long) area->addr;
168 if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size, 167 if (ioremap_page_range(vaddr, vaddr + size, phys_addr, prot)) {
169 phys_addr, prot)) { 168 remove_vm_area((void *)(vaddr & PAGE_MASK));
170 remove_vm_area((void *)(PAGE_MASK & (unsigned long) addr));
171 return NULL; 169 return NULL;
172 } 170 }
173 171
174 if (ioremap_change_attr(phys_addr, size, mode) < 0) { 172 if (ioremap_change_attr(phys_addr, size, mode) < 0) {
175 vunmap(addr); 173 vunmap(area->addr);
176 return NULL; 174 return NULL;
177 } 175 }
178 176
179 return (void __iomem *) (offset + (char __iomem *)addr); 177 return (void __iomem *) (vaddr + offset);
180} 178}
181 179
182/** 180/**