patch-2.3.41 linux/include/asm-m68k/virtconvert.h

Next file: linux/include/asm-mips/siginfo.h
Previous file: linux/include/asm-m68k/uaccess.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.40/linux/include/asm-m68k/virtconvert.h linux/include/asm-m68k/virtconvert.h
@@ -9,6 +9,7 @@
 
 #include <linux/config.h>
 #include <asm/setup.h>
+#include <asm/page.h>
 
 #ifdef CONFIG_AMIGA
 #include <asm/amigahw.h>
@@ -34,22 +35,22 @@
 #endif 
 
 #ifdef CONFIG_SINGLE_MEMORY_CHUNK
-extern inline unsigned long virt_to_phys(volatile void * address)
+extern inline unsigned long virt_to_phys(volatile void *vaddr)
 {
-	unsigned long voff = (unsigned long) address;
+	unsigned long voff = (unsigned long)vaddr - PAGE_OFFSET;
 
 	if (voff < m68k_memory[0].size)
-		return m68k_memory[0].addr + voff;
-	else
-		return mm_vtop_fallback(voff);
+		return voff + m68k_memory[0].addr;
+	return mm_vtop_fallback((unsigned long)vaddr);
 }
 
 extern inline void * phys_to_virt(unsigned long paddr)
 {
-	unsigned long base = m68k_memory[0].addr;
+	unsigned long poff = paddr - m68k_memory[0].addr;
+
+	if (poff < m68k_memory[0].size)
+		return (void *)(poff + PAGE_OFFSET);
 
-	if ((paddr >=  base) && (paddr < (base + m68k_memory[0].size)))
-		return (void *)(paddr - base);
 #ifdef CONFIG_AMIGA
 	/*
 	 * if on an amiga and address is in first 16M, move it 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)