diff options
author | Sonic Zhang <sonic.zhang@analog.com> | 2011-10-31 17:08:31 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-31 17:30:48 -0700 |
commit | 06d5e032adcbc7d50c606a1396f00e2474e4213e (patch) | |
tree | c9c0134ecc8d26f43749b2108325cd8e1bcaadfd | |
parent | 37a1c49a91ad55f917a399ef2174b5ebda4283f9 (diff) | |
download | linux-3.10-06d5e032adcbc7d50c606a1396f00e2474e4213e.tar.gz linux-3.10-06d5e032adcbc7d50c606a1396f00e2474e4213e.tar.bz2 linux-3.10-06d5e032adcbc7d50c606a1396f00e2474e4213e.zip |
include/asm-generic/page.h: calculate virt_to_page and page_to_virt via predefined macro
On NOMMU architectures, if physical memory doesn't start from 0,
ARCH_PFN_OFFSET is defined to generate page index in mem_map array.
Because virtual address is equal to physical address, PAGE_OFFSET is
always 0. virt_to_page and page_to_virt should not index page by
PAGE_OFFSET directly.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Cc: Greg Ungerer <gerg@snapgear.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/asm-generic/page.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h index 75fec18cdc5..351889d1de1 100644 --- a/include/asm-generic/page.h +++ b/include/asm-generic/page.h @@ -79,8 +79,8 @@ extern unsigned long memory_end; #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) -#define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)) -#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) +#define virt_to_page(addr) pfn_to_page(virt_to_pfn(addr)) +#define page_to_virt(page) pfn_to_virt(page_to_pfn(page)) #ifndef page_to_phys #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) |