]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/mm/lmb.c
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[linux-2.6-omap-h63xx.git] / arch / powerpc / mm / lmb.c
index 8b6f522655a62c56542629c2b7da3455ebd4b867..8f4d2dc4cafb0e832039799c364d8bccfc67d51b 100644 (file)
@@ -10,7 +10,6 @@
  *      2 of the License, or (at your option) any later version.
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
@@ -139,14 +138,18 @@ void __init lmb_analyze(void)
 static long __init lmb_add_region(struct lmb_region *rgn, unsigned long base,
                                  unsigned long size)
 {
-       unsigned long i, coalesced = 0;
-       long adjacent;
+       unsigned long coalesced = 0;
+       long adjacent, i;
 
        /* First try and coalesce this LMB with another. */
        for (i=0; i < rgn->cnt; i++) {
                unsigned long rgnbase = rgn->region[i].base;
                unsigned long rgnsize = rgn->region[i].size;
 
+               if ((rgnbase == base) && (rgnsize == size))
+                       /* Already have this region, so we're done */
+                       return 0;
+
                adjacent = lmb_addrs_adjacent(base,size,rgnbase,rgnsize);
                if ( adjacent > 0 ) {
                        rgn->region[i].base -= size;
@@ -321,7 +324,8 @@ void __init lmb_enforce_memory_limit(unsigned long memory_limit)
                break;
        }
 
-       lmb.rmo_size = lmb.memory.region[0].size;
+       if (lmb.memory.region[0].size < lmb.rmo_size)
+               lmb.rmo_size = lmb.memory.region[0].size;
 
        /* And truncate any reserves above the limit also. */
        for (i = 0; i < lmb.reserved.cnt; i++) {