From: Franck Bui-Huu <vagabon.xyz@gmail.com>
To: ralf@linux-mips.org
Cc: anemo@mba.ocn.ne.jp, ths@networkno.de, linux-mips@linux-mips.org,
Franck Bui-Huu <fbuihuu@gmail.com>
Subject: [PATCH 1/7] page.h: remove __pa() usages.
Date: Thu, 19 Oct 2006 13:19:59 +0200 [thread overview]
Message-ID: <11612568052569-git-send-email-fbuihuu@gmail.com> (raw)
In-Reply-To: <11612568052624-git-send-email-fbuihuu@gmail.com>
__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>
---
arch/mips/mm/init.c | 8 ++++----
include/asm-mips/io.h | 2 +-
include/asm-mips/page.h | 6 ++++--
include/asm-mips/pgtable.h | 2 +-
4 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 2f346d1..4431ea0 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -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++;
}
@@ -490,8 +490,8 @@ void free_init_pages(char *what, unsigne
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++;
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index d5307dd..9b9f804 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -113,7 +113,7 @@ #endif
* 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;
}
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index 32e5625..fa4e4d9 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -34,7 +34,9 @@ #define PAGE_MASK (~((1 << PAGE_SH
#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);
@@ -157,8 +159,8 @@ ({ \
#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)
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index 1ca4d1e..f2e1325 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -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) \
--
1.4.2.3
next prev parent reply other threads:[~2006-10-19 11:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-19 11:19 [PATCH 0/7] Get ride of CPHYSADDR() in setup.c [take #4] Franck Bui-Huu
2006-10-19 11:19 ` Franck Bui-Huu [this message]
2006-10-19 11:20 ` [PATCH 2/7] Make __pa() aware of XKPHYS/CKSEG0 address mix for 64 bit kernels Franck Bui-Huu
2006-10-19 11:20 ` [PATCH 3/7] setup.c: get ride of CPHYSADDR() Franck Bui-Huu
2006-10-19 11:20 ` [PATCH 4/7] Introduce __pa_symbol() Franck Bui-Huu
2006-10-19 11:20 ` [PATCH 5/7] setup.c: use __pa_symbol() where needed Franck Bui-Huu
2006-10-19 11:20 ` [PATCH 6/7] setup.c: clean up initrd related code Franck Bui-Huu
2006-10-19 11:20 ` [PATCH 7/7] Make free_init_pages() arguments to be physical addresses Franck Bui-Huu
2006-10-20 3:19 ` [PATCH 0/7] Get ride of CPHYSADDR() in setup.c [take #4] Atsushi Nemoto
-- strict thread matches above, loose matches on Subject: below --
2006-10-16 16:12 [PATCH 0/7] Get ride of CPHYSADDR() in setup.c [take #3] Franck Bui-Huu
2006-10-16 16:12 ` [PATCH 1/7] page.h: remove __pa() usages Franck Bui-Huu
2006-10-13 12:38 [PATCH 0/7] Get ride of CPHYSADDR() in setup.c [take #2] Franck Bui-Huu
2006-10-13 12:39 ` [PATCH 1/7] page.h: remove __pa() usages Franck Bui-Huu
2006-10-13 16:27 ` Atsushi Nemoto
2006-10-14 9:22 ` Franck Bui-Huu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11612568052569-git-send-email-fbuihuu@gmail.com \
--to=vagabon.xyz@gmail.com \
--cc=anemo@mba.ocn.ne.jp \
--cc=fbuihuu@gmail.com \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=ths@networkno.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox