Commit b9fa8456 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Clean up MAX_NR_NODES/NUMNODES/etc. [4/5]

From: Matthew Dobson <colpatch@us.ibm.com>

Fix up the arm arch.  This needs to be reviewed.  Relatively
straightforward replacement of NR_NODES with standard MAX_NUMNODES.
parent dbe97702
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#if NR_NODES != 4 #if MAX_NUMNODES != 4
#error Fix Me Please #error Fix Me Please
#endif #endif
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
* Our node_data structure for discontiguous memory. * Our node_data structure for discontiguous memory.
*/ */
static bootmem_data_t node_bootmem_data[NR_NODES]; static bootmem_data_t node_bootmem_data[MAX_NUMNODES];
pg_data_t discontig_node_data[NR_NODES] = { pg_data_t discontig_node_data[MAX_NUMNODES] = {
{ .bdata = &node_bootmem_data[0] }, { .bdata = &node_bootmem_data[0] },
{ .bdata = &node_bootmem_data[1] }, { .bdata = &node_bootmem_data[1] },
{ .bdata = &node_bootmem_data[2] }, { .bdata = &node_bootmem_data[2] },
......
...@@ -33,12 +33,6 @@ ...@@ -33,12 +33,6 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#ifndef CONFIG_DISCONTIGMEM
#define NR_NODES 1
#else
#define NR_NODES 4
#endif
#ifdef CONFIG_CPU_32 #ifdef CONFIG_CPU_32
#define TABLE_OFFSET (PTRS_PER_PTE) #define TABLE_OFFSET (PTRS_PER_PTE)
#else #else
...@@ -178,7 +172,7 @@ find_memend_and_nodes(struct meminfo *mi, struct node_info *np) ...@@ -178,7 +172,7 @@ find_memend_and_nodes(struct meminfo *mi, struct node_info *np)
{ {
unsigned int i, bootmem_pages = 0, memend_pfn = 0; unsigned int i, bootmem_pages = 0, memend_pfn = 0;
for (i = 0; i < NR_NODES; i++) { for (i = 0; i < MAX_NUMNODES; i++) {
np[i].start = -1U; np[i].start = -1U;
np[i].end = 0; np[i].end = 0;
np[i].bootmap_pages = 0; np[i].bootmap_pages = 0;
...@@ -207,7 +201,7 @@ find_memend_and_nodes(struct meminfo *mi, struct node_info *np) ...@@ -207,7 +201,7 @@ find_memend_and_nodes(struct meminfo *mi, struct node_info *np)
* we have, we're in trouble. (maybe we ought to * we have, we're in trouble. (maybe we ought to
* limit, instead of bugging?) * limit, instead of bugging?)
*/ */
if (numnodes > NR_NODES) if (numnodes > MAX_NUMNODES)
BUG(); BUG();
} }
...@@ -365,7 +359,7 @@ static inline void free_bootmem_node_bank(int node, struct meminfo *mi) ...@@ -365,7 +359,7 @@ static inline void free_bootmem_node_bank(int node, struct meminfo *mi)
*/ */
void __init bootmem_init(struct meminfo *mi) void __init bootmem_init(struct meminfo *mi)
{ {
struct node_info node_info[NR_NODES], *np = node_info; struct node_info node_info[MAX_NUMNODES], *np = node_info;
unsigned int bootmap_pages, bootmap_pfn, map_pg; unsigned int bootmap_pages, bootmap_pfn, map_pg;
int node, initrd_node; int node, initrd_node;
......
...@@ -109,8 +109,6 @@ ...@@ -109,8 +109,6 @@
* node 3: 0xd8000000 - 0xdfffffff * node 3: 0xd8000000 - 0xdfffffff
*/ */
#define NR_NODES 4
/* /*
* Given a kernel address, find the home node of the underlying memory. * Given a kernel address, find the home node of the underlying memory.
*/ */
......
...@@ -74,8 +74,6 @@ ...@@ -74,8 +74,6 @@
* node 3: 0xd8000000 - 0xdfffffff * node 3: 0xd8000000 - 0xdfffffff
*/ */
#define NR_NODES 4
/* /*
* Given a kernel address, find the home node of the underlying memory. * Given a kernel address, find the home node of the underlying memory.
*/ */
......
...@@ -89,6 +89,9 @@ static inline void *phys_to_virt(unsigned long x) ...@@ -89,6 +89,9 @@ static inline void *phys_to_virt(unsigned long x)
* This is more complex. We have a set of mem_map arrays spread * This is more complex. We have a set of mem_map arrays spread
* around in memory. * around in memory.
*/ */
#include <asm/numnodes.h>
#define NUM_NODES (1 << NODES_SHIFT)
#define page_to_pfn(page) \ #define page_to_pfn(page) \
(( (page) - page_zone(page)->zone_mem_map) \ (( (page) - page_zone(page)->zone_mem_map) \
+ page_zone(page)->zone_start_pfn) + page_zone(page)->zone_start_pfn)
...@@ -96,12 +99,12 @@ static inline void *phys_to_virt(unsigned long x) ...@@ -96,12 +99,12 @@ static inline void *phys_to_virt(unsigned long x)
#define pfn_to_page(pfn) \ #define pfn_to_page(pfn) \
(PFN_TO_MAPBASE(pfn) + LOCAL_MAP_NR((pfn) << PAGE_SHIFT)) (PFN_TO_MAPBASE(pfn) + LOCAL_MAP_NR((pfn) << PAGE_SHIFT))
#define pfn_valid(pfn) (PFN_TO_NID(pfn) < NR_NODES) #define pfn_valid(pfn) (PFN_TO_NID(pfn) < NUM_NODES)
#define virt_to_page(kaddr) \ #define virt_to_page(kaddr) \
(ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr)) (ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr))
#define virt_addr_valid(kaddr) (KVADDR_TO_NID(kaddr) < NR_NODES) #define virt_addr_valid(kaddr) (KVADDR_TO_NID(kaddr) < NUM_NODES)
/* /*
* Common discontigmem stuff. * Common discontigmem stuff.
...@@ -109,6 +112,8 @@ static inline void *phys_to_virt(unsigned long x) ...@@ -109,6 +112,8 @@ static inline void *phys_to_virt(unsigned long x)
*/ */
#define PHYS_TO_NID(addr) PFN_TO_NID((addr) >> PAGE_SHIFT) #define PHYS_TO_NID(addr) PFN_TO_NID((addr) >> PAGE_SHIFT)
#undef NUM_NODES
#endif #endif
/* /*
......
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
#ifndef __ASM_ARM_NUMNODES_H #ifndef __ASM_ARM_NUMNODES_H
#define __ASM_ARM_NUMNODES_H #define __ASM_ARM_NUMNODES_H
#include <asm/memory.h> /* Max 4 Nodes */
#define NODES_SHIFT 2
#define MAX_NUMNODES NR_NODES
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment