diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2007-05-10 03:06:30 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-05-10 07:28:13 -0400 |
commit | 40472a55461a672c929a092e648f6c5d21c9c310 (patch) | |
tree | 0c15281e208b14f3ffa3367584ff3392412e0f31 | |
parent | 2454c7e98c0dd0aff29dfe1ee369801507f4d6a5 (diff) |
[POWERPC] Split initrd logic out of early_init_dt_scan_chosen() to fix warning
If CONFIG_BLK_DEV_INITRD is not defined the prop variable in
early_init_dt_scan_chosen() is unused, causing a compiler warning.
So split the initrd logic into a separate function, allowing us to
declare prop only when we need it.
Built for both cases and booted with an initrd.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/kernel/prom.c | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index caef555f2dc0..c065b5550368 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -716,11 +716,40 @@ static int __init early_init_dt_scan_cpus(unsigned long node, | |||
716 | return 0; | 716 | return 0; |
717 | } | 717 | } |
718 | 718 | ||
719 | #ifdef CONFIG_BLK_DEV_INITRD | ||
720 | static void __init early_init_dt_check_for_initrd(unsigned long node) | ||
721 | { | ||
722 | unsigned long l; | ||
723 | u32 *prop; | ||
724 | |||
725 | DBG("Looking for initrd properties... "); | ||
726 | |||
727 | prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l); | ||
728 | if (prop) { | ||
729 | initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4)); | ||
730 | |||
731 | prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l); | ||
732 | if (prop) { | ||
733 | initrd_end = (unsigned long) | ||
734 | __va(of_read_ulong(prop, l/4)); | ||
735 | initrd_below_start_ok = 1; | ||
736 | } else { | ||
737 | initrd_start = 0; | ||
738 | } | ||
739 | } | ||
740 | |||
741 | DBG("initrd_start=0x%lx initrd_end=0x%lx\n", initrd_start, initrd_end); | ||
742 | } | ||
743 | #else | ||
744 | static inline void early_init_dt_check_for_initrd(unsigned long node) | ||
745 | { | ||
746 | } | ||
747 | #endif /* CONFIG_BLK_DEV_INITRD */ | ||
748 | |||
719 | static int __init early_init_dt_scan_chosen(unsigned long node, | 749 | static int __init early_init_dt_scan_chosen(unsigned long node, |
720 | const char *uname, int depth, void *data) | 750 | const char *uname, int depth, void *data) |
721 | { | 751 | { |
722 | unsigned long *lprop; | 752 | unsigned long *lprop; |
723 | u32 *prop; | ||
724 | unsigned long l; | 753 | unsigned long l; |
725 | char *p; | 754 | char *p; |
726 | 755 | ||
@@ -762,21 +791,7 @@ static int __init early_init_dt_scan_chosen(unsigned long node, | |||
762 | crashk_res.end = crashk_res.start + *lprop - 1; | 791 | crashk_res.end = crashk_res.start + *lprop - 1; |
763 | #endif | 792 | #endif |
764 | 793 | ||
765 | #ifdef CONFIG_BLK_DEV_INITRD | 794 | early_init_dt_check_for_initrd(node); |
766 | DBG("Looking for initrd properties... "); | ||
767 | prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l); | ||
768 | if (prop) { | ||
769 | initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4)); | ||
770 | prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l); | ||
771 | if (prop) { | ||
772 | initrd_end = (unsigned long)__va(of_read_ulong(prop, l/4)); | ||
773 | initrd_below_start_ok = 1; | ||
774 | } else { | ||
775 | initrd_start = 0; | ||
776 | } | ||
777 | } | ||
778 | DBG("initrd_start=0x%lx initrd_end=0x%lx\n", initrd_start, initrd_end); | ||
779 | #endif /* CONFIG_BLK_DEV_INITRD */ | ||
780 | 795 | ||
781 | /* Retreive command line */ | 796 | /* Retreive command line */ |
782 | p = of_get_flat_dt_prop(node, "bootargs", &l); | 797 | p = of_get_flat_dt_prop(node, "bootargs", &l); |