arm64: numa: simplify dummy_numa_init()
[linux-2.6-microblaze.git] / arch / arm64 / mm / numa.c
index 73f8b49..2040b97 100644 (file)
@@ -46,7 +46,11 @@ EXPORT_SYMBOL(node_to_cpumask_map);
  */
 const struct cpumask *cpumask_of_node(int node)
 {
-       if (WARN_ON(node >= nr_node_ids))
+
+       if (node == NUMA_NO_NODE)
+               return cpu_all_mask;
+
+       if (WARN_ON(node < 0 || node >= nr_node_ids))
                return cpu_none_mask;
 
        if (WARN_ON(node_to_cpumask_map[node] == NULL))
@@ -423,19 +427,16 @@ out_free_distance:
  */
 static int __init dummy_numa_init(void)
 {
+       phys_addr_t start = memblock_start_of_DRAM();
+       phys_addr_t end = memblock_end_of_DRAM();
        int ret;
-       struct memblock_region *mblk;
 
        if (numa_off)
                pr_info("NUMA disabled\n"); /* Forced off on command line. */
-       pr_info("Faking a node at [mem %#018Lx-%#018Lx]\n",
-               memblock_start_of_DRAM(), memblock_end_of_DRAM() - 1);
-
-       for_each_memblock(memory, mblk) {
-               ret = numa_add_memblk(0, mblk->base, mblk->base + mblk->size);
-               if (!ret)
-                       continue;
+       pr_info("Faking a node at [mem %#018Lx-%#018Lx]\n", start, end - 1);
 
+       ret = numa_add_memblk(0, start, end);
+       if (ret) {
                pr_err("NUMA init failed\n");
                return ret;
        }
@@ -448,7 +449,7 @@ static int __init dummy_numa_init(void)
  * arm64_numa_init() - Initialize NUMA
  *
  * Try each configured NUMA initialization method until one succeeds. The
- * last fallback is dummy single node config encomapssing whole memory.
+ * last fallback is dummy single node config encompassing whole memory.
  */
 void __init arm64_numa_init(void)
 {