aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-05-06 13:57:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-05-06 13:57:37 -0400
commit3d54ac9e35a69d19381420bb2fa1702d5bf73846 (patch)
tree7dd5ef57cfc4c7771ef5250abaef2072a69c8a3b /arch/x86/mm
parentd8fce2db7220fc46067c825fc417fb295eac7d0a (diff)
parentc88d47480d300eaad80c213d50c9bf6077fc49bc (diff)
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar: "EFI fixes, and FPU fix, a ticket spinlock boundary condition fix and two build fixes" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/fpu: Always restore_xinit_state() when use_eager_cpu() x86: Make cpu_tss available to external modules efi: Fix error handling in add_sysfs_runtime_map_entry() x86/spinlocks: Fix regression in spinlock contention detection x86/mm: Clean up types in xlate_dev_mem_ptr() x86/efi: Store upper bits of command line buffer address in ext_cmd_line_ptr efivarfs: Ensure VariableName is NUL-terminated
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/ioremap.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 5ead4d6cf3a7..70e7444c6835 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -351,18 +351,20 @@ int arch_ioremap_pmd_supported(void)
351 */ 351 */
352void *xlate_dev_mem_ptr(phys_addr_t phys) 352void *xlate_dev_mem_ptr(phys_addr_t phys)
353{ 353{
354 void *addr; 354 unsigned long start = phys & PAGE_MASK;
355 unsigned long start = phys & PAGE_MASK; 355 unsigned long offset = phys & ~PAGE_MASK;
356 unsigned long vaddr;
356 357
357 /* If page is RAM, we can use __va. Otherwise ioremap and unmap. */ 358 /* If page is RAM, we can use __va. Otherwise ioremap and unmap. */
358 if (page_is_ram(start >> PAGE_SHIFT)) 359 if (page_is_ram(start >> PAGE_SHIFT))
359 return __va(phys); 360 return __va(phys);
360 361
361 addr = (void __force *)ioremap_cache(start, PAGE_SIZE); 362 vaddr = (unsigned long)ioremap_cache(start, PAGE_SIZE);
362 if (addr) 363 /* Only add the offset on success and return NULL if the ioremap() failed: */
363 addr = (void *)((unsigned long)addr | (phys & ~PAGE_MASK)); 364 if (vaddr)
365 vaddr += offset;
364 366
365 return addr; 367 return (void *)vaddr;
366} 368}
367 369
368void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr) 370void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)