tree d8355e0b1302b201114c9998570c0a4ee7a26fcc
parent 180379dcefb39e8bd05d562b0685e9084dffcc0a
author Michael Ellerman <[EMAIL PROTECTED]> Wed, 03 Aug 2005 20:21:26 +1000
committer Paul Mackerras <[EMAIL PROTECTED]> Mon, 29 Aug 2005 10:53:37 +1000

[PATCH] ppc64: Simplify some lmb functions

lmb_phys_mem_size() can always return lmb.memory.size, as long as it's called
after lmb_analyze(), which it is. There's no need to recalculate the size on
every call.

lmb_analyze() was calculating a few things we then threw away, so just don't
calculate them to start with.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>

 arch/ppc64/kernel/lmb.c |   27 +++++----------------------
 1 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/arch/ppc64/kernel/lmb.c b/arch/ppc64/kernel/lmb.c
--- a/arch/ppc64/kernel/lmb.c
+++ b/arch/ppc64/kernel/lmb.c
@@ -119,20 +119,12 @@ lmb_init(void)
 void __init
 lmb_analyze(void)
 {
-       unsigned long i;
-       unsigned long mem_size = 0;
-       unsigned long size_mask = 0;
-
-       for (i=0; i < lmb.memory.cnt; i++) {
-               unsigned long lmb_size;
+       int i;
 
-               lmb_size = lmb.memory.region[i].size;
+       lmb.memory.size = 0;
 
-               mem_size += lmb_size;
-               size_mask |= lmb_size;
-       }
-
-       lmb.memory.size = mem_size;
+       for (i = 0; i < lmb.memory.cnt; i++)
+               lmb.memory.size += lmb.memory.region[i].size;
 }
 
 /* This routine called with relocation disabled. */
@@ -266,20 +258,11 @@ lmb_alloc_base(unsigned long size, unsig
        return base;
 }
 
+/* You must call lmb_analyze() before this. */
 unsigned long __init
 lmb_phys_mem_size(void)
 {
-#ifdef CONFIG_MSCHUNKS
        return lmb.memory.size;
-#else
-       unsigned long total = 0;
-       int i;
-
-       /* add all physical memory to the bootmem map */
-       for (i=0; i < lmb.memory.cnt; i++)
-               total += lmb.memory.region[i].size;
-       return total;
-#endif /* CONFIG_MSCHUNKS */
 }
 
 unsigned long __init
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to