Merge tag 'backlight-for-linus-3.16' of git://git.kernel.org/pub/scm/linux/kernel...
[firefly-linux-kernel-4.4.55.git] / arch / arm / kernel / setup.c
index f5120ca086711820e9174f039ea122d09ec33117..8a16ee5d8a953f6c54ed6c14ed394d7ceae1fc37 100644 (file)
@@ -631,15 +631,8 @@ void __init dump_machine_table(void)
 
 int __init arm_add_memory(u64 start, u64 size)
 {
-       struct membank *bank = &meminfo.bank[meminfo.nr_banks];
        u64 aligned_start;
 
-       if (meminfo.nr_banks >= NR_BANKS) {
-               pr_crit("NR_BANKS too low, ignoring memory at 0x%08llx\n",
-                       (long long)start);
-               return -EINVAL;
-       }
-
        /*
         * Ensure that start/size are aligned to a page boundary.
         * Size is appropriately rounded down, start is rounded up.
@@ -680,17 +673,17 @@ int __init arm_add_memory(u64 start, u64 size)
                aligned_start = PHYS_OFFSET;
        }
 
-       bank->start = aligned_start;
-       bank->size = size & ~(phys_addr_t)(PAGE_SIZE - 1);
+       start = aligned_start;
+       size = size & ~(phys_addr_t)(PAGE_SIZE - 1);
 
        /*
         * Check whether this memory region has non-zero size or
         * invalid node number.
         */
-       if (bank->size == 0)
+       if (size == 0)
                return -EINVAL;
 
-       meminfo.nr_banks++;
+       memblock_add(start, size);
        return 0;
 }
 
@@ -698,6 +691,7 @@ int __init arm_add_memory(u64 start, u64 size)
  * Pick out the memory size.  We look for mem=size@start,
  * where start and size are "size[KkMm]"
  */
+
 static int __init early_mem(char *p)
 {
        static int usermem __initdata = 0;
@@ -712,7 +706,8 @@ static int __init early_mem(char *p)
         */
        if (usermem == 0) {
                usermem = 1;
-               meminfo.nr_banks = 0;
+               memblock_remove(memblock_start_of_DRAM(),
+                       memblock_end_of_DRAM() - memblock_start_of_DRAM());
        }
 
        start = PHYS_OFFSET;
@@ -857,13 +852,6 @@ static void __init reserve_crashkernel(void)
 static inline void reserve_crashkernel(void) {}
 #endif /* CONFIG_KEXEC */
 
-static int __init meminfo_cmp(const void *_a, const void *_b)
-{
-       const struct membank *a = _a, *b = _b;
-       long cmp = bank_pfn_start(a) - bank_pfn_start(b);
-       return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
-}
-
 void __init hyp_mode_check(void)
 {
 #ifdef CONFIG_ARM_VIRT_EXT
@@ -906,12 +894,10 @@ void __init setup_arch(char **cmdline_p)
 
        parse_early_param();
 
-       sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
-
        early_paging_init(mdesc, lookup_processor_type(read_cpuid_id()));
        setup_dma_zone(mdesc);
        sanity_check_meminfo();
-       arm_memblock_init(&meminfo, mdesc);
+       arm_memblock_init(mdesc);
 
        paging_init(mdesc);
        request_standard_resources(mdesc);