]> Pileus Git - ~andy/linux/commitdiff
[MIPS] page.h: remove __pa() usages.
authorFranck Bui-Huu <vagabon.xyz@gmail.com>
Thu, 19 Oct 2006 11:19:59 +0000 (13:19 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 30 Nov 2006 01:14:40 +0000 (01:14 +0000)
__pa() was used by virt_to_page() and virt_addr_valid(). These
latter are used when kernel is initialised so __pa() is not
appropriate, we use virt_to_phys() instead.

Futhermore __pa() is going to take care of CKSEG0/XKPHYS
address mix for 64 bit kernels. This makes __pa() more complex
than virt_to_phys() and this extra work is not needed by
virt_to_page() and virt_addr_valid().

Eventually it consolidates virt_to_phys() prototype by making
its argument 'const'. this avoids some warnings that was due
to some virt_to_page() usages which pass const pointer.

Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/mm/init.c
include/asm-mips/io.h
include/asm-mips/page.h
include/asm-mips/pgtable.h

index 2de4d3c367a2c2da9adb6bcf29b5105c46c01f78..304991263f6b48ca9f54a5b5f64581a9b2cc581a 100644 (file)
@@ -90,9 +90,9 @@ unsigned long setup_zero_pages(void)
        if (!empty_zero_page)
                panic("Oh boy, that early out of memory?");
 
-       page = virt_to_page(empty_zero_page);
+       page = virt_to_page((void *)empty_zero_page);
        split_page(page, order);
-       while (page < virt_to_page(empty_zero_page + (PAGE_SIZE << order))) {
+       while (page < virt_to_page((void *)(empty_zero_page + (PAGE_SIZE << order)))) {
                SetPageReserved(page);
                page++;
        }
@@ -448,8 +448,8 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
        unsigned long addr;
 
        for (addr = begin; addr < end; addr += PAGE_SIZE) {
-               ClearPageReserved(virt_to_page(addr));
-               init_page_count(virt_to_page(addr));
+               ClearPageReserved(virt_to_page((void *)addr));
+               init_page_count(virt_to_page((void *)addr));
                memset((void *)addr, 0xcc, PAGE_SIZE);
                free_page(addr);
                totalram_pages++;
index bc5f3c53155f2983b9d31b7e6cfd77e103290175..d77b657c09c794e03ae04c89e7e2018f50809168 100644 (file)
@@ -113,7 +113,7 @@ static inline void set_io_port_base(unsigned long base)
  *     almost all conceivable cases a device driver should not be using
  *     this function
  */
-static inline unsigned long virt_to_phys(volatile void * address)
+static inline unsigned long virt_to_phys(volatile const void *address)
 {
        return (unsigned long)address - PAGE_OFFSET;
 }
index 85b258ee7090737d4864ae068f00833bb8e59f53..edb33a14ae9e332bbbd6788b093861d38a10931b 100644 (file)
@@ -34,7 +34,9 @@
 
 #ifndef __ASSEMBLY__
 
+#include <linux/pfn.h>
 #include <asm/cpu-features.h>
+#include <asm/io.h>
 
 extern void clear_page(void * page);
 extern void copy_page(void * to, void * from);
@@ -160,8 +162,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;
 
 #endif
 
-#define virt_to_page(kaddr)    pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
-#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
+#define virt_to_page(kaddr)    pfn_to_page(PFN_DOWN(virt_to_phys(kaddr)))
+#define virt_addr_valid(kaddr) pfn_valid(PFN_DOWN(virt_to_phys(kaddr)))
 
 #define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE | VM_EXEC | \
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
index 1ca4d1e185c7f1b97d05b223813bb84c1afa6288..f2e1325fec6c36efbfab47d7810c847019c26006 100644 (file)
@@ -67,7 +67,7 @@ extern unsigned long empty_zero_page;
 extern unsigned long zero_page_mask;
 
 #define ZERO_PAGE(vaddr) \
-       (virt_to_page(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask)))
+       (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))))
 
 #define __HAVE_ARCH_MOVE_PTE
 #define move_pte(pte, prot, old_addr, new_addr)                                \