[PATCH 5/12] ppc64: Add __va_ul() which does __va() but returns unsigned long

Michael Ellerman michael at ellerman.id.au
Fri Aug 26 12:53:24 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.

Signed-off-by: Michael Ellerman <michael at ellerman.id.au>
---

 arch/ppc64/kernel/iSeries_setup.c     |    4 ++--
 arch/ppc64/kernel/pSeries_iommu.c     |    2 +-
 arch/ppc64/kernel/setup.c             |    4 ++--
 arch/ppc64/oprofile/op_model_power4.c |    2 +-
 include/asm-ppc64/page.h              |    3 ++-
 5 files changed, 8 insertions(+), 7 deletions(-)

Index: work/include/asm-ppc64/page.h
===================================================================
--- work.orig/include/asm-ppc64/page.h
+++ work/include/asm-ppc64/page.h
@@ -220,7 +220,8 @@ extern u64 ppc64_pft_size;		/* Log 2 of 
 #define USER_REGION_ID     (0UL)
 #define REGION_ID(ea)	   (((unsigned long)(ea)) >> REGION_SHIFT)
 
-#define __va(x) ((void *)((unsigned long)(x) + KERNELBASE))
+#define __va_ul(x) (((unsigned long)(x) + KERNELBASE))
+#define __va(x) ((void *)__va_ul(x))
 
 #ifdef CONFIG_DISCONTIGMEM
 #define page_to_pfn(page)	discontigmem_page_to_pfn(page)
Index: work/arch/ppc64/kernel/iSeries_setup.c
===================================================================
--- work.orig/arch/ppc64/kernel/iSeries_setup.c
+++ work/arch/ppc64/kernel/iSeries_setup.c
@@ -325,7 +325,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;
@@ -667,7 +667,7 @@ static void __init iSeries_bolt_kernel(u
 	hpte_t hpte;
 
 	for (pa = saddr; pa < eaddr ;pa += PAGE_SIZE) {
-		unsigned long ea = (unsigned long)__va(pa);
+		unsigned long ea = __va_ul(pa);
 		unsigned long vsid = get_kernel_vsid(ea);
 		unsigned long va = (vsid << 28) | (pa & 0xfffffff);
 		unsigned long vpn = va >> PAGE_SHIFT;
Index: work/arch/ppc64/kernel/pSeries_iommu.c
===================================================================
--- work.orig/arch/ppc64/kernel/pSeries_iommu.c
+++ work/arch/ppc64/kernel/pSeries_iommu.c
@@ -256,7 +256,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: work/arch/ppc64/kernel/setup.c
===================================================================
--- work.orig/arch/ppc64/kernel/setup.c
+++ work/arch/ppc64/kernel/setup.c
@@ -540,11 +540,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: work/arch/ppc64/oprofile/op_model_power4.c
===================================================================
--- work.orig/arch/ppc64/oprofile/op_model_power4.c
+++ work/arch/ppc64/oprofile/op_model_power4.c
@@ -233,7 +233,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)



More information about the Linuxppc64-dev mailing list