
From: Rusty Russell <rusty@rustcorp.com.au>

Doesn't compile with CONFIG_BLK_DEV_INITRD=n.  Be more careful with the
conditionals.

Spotted by Dave Boutcher...


---

 25-akpm/arch/ppc64/kernel/prom.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff -puN arch/ppc64/kernel/prom.c~promc-fix-for-config_blk_dev_initrd=n arch/ppc64/kernel/prom.c
--- 25/arch/ppc64/kernel/prom.c~promc-fix-for-config_blk_dev_initrd=n	2004-04-25 22:36:38.391251504 -0700
+++ 25-akpm/arch/ppc64/kernel/prom.c	2004-04-25 22:36:38.396250744 -0700
@@ -1548,6 +1548,7 @@ static void __init *__make_room(unsigned
 
 	*mem_start = ALIGN(*mem_start, align);
 	if (*mem_start + needed > *mem_end) {
+#ifdef CONFIG_BLK_DEV_INITRD
 		/* FIXME: Apple OF doesn't map unclaimed mem.  If this
 		 * ever happened on G5, we'd need to fix. */
 		unsigned long initrd_len;
@@ -1563,6 +1564,9 @@ static void __init *__make_room(unsigned
 			initrd_len);
 		RELOC(initrd_start) = *mem_end;
 		RELOC(initrd_end) = RELOC(initrd_start) + initrd_len;
+#else
+		prom_panic(RELOC("No memory for copy_device_tree"));
+#endif
 	}
 
 	ret = (void *)*mem_start;
@@ -1699,11 +1703,14 @@ copy_device_tree(unsigned long mem_start
 	phandle root;
 	struct device_node **allnextp;
 	unsigned long offset = reloc_offset();
-	unsigned long mem_end = RELOC(initrd_start);
+	unsigned long mem_end;
 
 	/* We pass mem_end-mem_start to OF: keep it well under 32-bit */
-	if (!mem_end)
-		mem_end = mem_start + 1024*1024*1024;
+	mem_end = mem_start + 1024*1024*1024;
+#ifdef CONFIG_BLK_DEV_INITRD
+	if (RELOC(initrd_start) && RELOC(initrd_start) > mem_start)
+		mem_end = RELOC(initrd_start);
+#endif /* CONFIG_BLK_DEV_INITRD */
 
 	root = call_prom(RELOC("peer"), 1, 1, (phandle)0);
 	if (root == (phandle)0) {
@@ -1964,12 +1971,14 @@ prom_init(unsigned long r3, unsigned lon
   	prom_print(RELOC("after basic inits, mem=0x"));
   	prom_print_hex(mem);
   	prom_print_nl();
+#ifdef CONFIG_BLK_DEV_INITRD
 	prom_print(RELOC("initrd_start=0x"));
 	prom_print_hex(RELOC(initrd_start));
 	prom_print_nl();
 	prom_print(RELOC("initrd_end=0x"));
 	prom_print_hex(RELOC(initrd_end));
 	prom_print_nl();
+#endif /* CONFIG_BLK_DEV_INITRD */
 	prom_print(RELOC("copying OF device tree...\n"));
 #endif /* DEBUG_PROM */
 	mem = copy_device_tree(mem);

_
