[PATCH 7/11] powerpc: Add __va_ul() which does __va() but returns unsigned long
Michael Ellerman
michael at ellerman.id.au
Mon Oct 17 21:48:44 EST 2005
Currently __va() returns void *, however about half of the callers of __va()
actually want an unsigned long as the return value.
So we add a __va_ul() macro that does this for us. Purely cosmetic.
While we're at it, remove a few redundant casts to void *.
Signed-off-by: Michael Ellerman <michael at ellerman.id.au>
---
arch/powerpc/kernel/setup_64.c | 4 ++--
arch/powerpc/mm/mem.c | 2 +-
arch/powerpc/oprofile/op_model_power4.c | 2 +-
arch/powerpc/platforms/iseries/setup.c | 2 +-
arch/powerpc/platforms/pseries/iommu.c | 2 +-
include/asm-powerpc/page.h | 3 ++-
include/asm-ppc64/io.h | 2 +-
7 files changed, 9 insertions(+), 8 deletions(-)
Index: kexec/include/asm-powerpc/page.h
===================================================================
--- kexec.orig/include/asm-powerpc/page.h
+++ kexec/include/asm-powerpc/page.h
@@ -331,7 +331,8 @@ static inline void* ___va(unsigned long
#define __pa(x) ___pa((unsigned long)(x))
/* Convert physical address to virtual. */
-#define __va(x) ((void *)___va((unsigned long)(x)))
+#define __va_ul(x) (___va((unsigned long)(x)))
+#define __va(x) ((void *)__va_ul(x))
#ifdef CONFIG_DISCONTIGMEM
#define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn)
Index: kexec/arch/powerpc/platforms/iseries/setup.c
===================================================================
--- kexec.orig/arch/powerpc/platforms/iseries/setup.c
+++ kexec/arch/powerpc/platforms/iseries/setup.c
@@ -318,7 +318,7 @@ static void __init iSeries_init_early(vo
* a non-zero starting address for it, set it up
*/
if (naca.xRamDisk) {
- initrd_start = (unsigned long)__va(naca.xRamDisk);
+ initrd_start = __va_ul(naca.xRamDisk);
initrd_end = initrd_start + naca.xRamDiskSize * PAGE_SIZE;
initrd_below_start_ok = 1; // ramdisk in kernel space
ROOT_DEV = Root_RAM0;
Index: kexec/arch/powerpc/platforms/pseries/iommu.c
===================================================================
--- kexec.orig/arch/powerpc/platforms/pseries/iommu.c
+++ kexec/arch/powerpc/platforms/pseries/iommu.c
@@ -272,7 +272,7 @@ static void iommu_table_setparms(struct
return;
}
- tbl->it_base = (unsigned long)__va(*basep);
+ tbl->it_base = __va_ul(*basep);
memset((void *)tbl->it_base, 0, *sizep);
tbl->it_busno = phb->bus->number;
Index: kexec/arch/powerpc/kernel/setup_64.c
===================================================================
--- kexec.orig/arch/powerpc/kernel/setup_64.c
+++ kexec/arch/powerpc/kernel/setup_64.c
@@ -509,11 +509,11 @@ static void __init check_for_initrd(void
prop = (u64 *)get_property(of_chosen,
"linux,initrd-start", NULL);
if (prop != NULL) {
- initrd_start = (unsigned long)__va(*prop);
+ initrd_start = __va_ul(*prop);
prop = (u64 *)get_property(of_chosen,
"linux,initrd-end", NULL);
if (prop != NULL) {
- initrd_end = (unsigned long)__va(*prop);
+ initrd_end = __va_ul(*prop);
initrd_below_start_ok = 1;
} else
initrd_start = 0;
Index: kexec/arch/powerpc/oprofile/op_model_power4.c
===================================================================
--- kexec.orig/arch/powerpc/oprofile/op_model_power4.c
+++ kexec/arch/powerpc/oprofile/op_model_power4.c
@@ -229,7 +229,7 @@ static unsigned long get_pc(struct pt_re
/* Were we in our exception vectors or SLB real mode miss handler? */
if (pc < 0x1000000UL)
- return (unsigned long)__va(pc);
+ return __va_ul(pc);
/* Not sure where we were */
if (pc < KERNELBASE)
Index: kexec/arch/powerpc/mm/mem.c
===================================================================
--- kexec.orig/arch/powerpc/mm/mem.c
+++ kexec/arch/powerpc/mm/mem.c
@@ -252,7 +252,7 @@ void __init mem_init(void)
unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize;
num_physpages = max_pfn; /* RAM is assumed contiguous */
- high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
+ high_memory = __va(max_low_pfn * PAGE_SIZE);
#ifdef CONFIG_NEED_MULTIPLE_NODES
for_each_online_node(nid) {
Index: kexec/include/asm-ppc64/io.h
===================================================================
--- kexec.orig/include/asm-ppc64/io.h
+++ kexec/include/asm-ppc64/io.h
@@ -238,7 +238,7 @@ static inline unsigned long virt_to_phys
*/
static inline void * phys_to_virt(unsigned long address)
{
- return (void *)__va(address);
+ return __va(address);
}
/*
More information about the Linuxppc64-dev
mailing list