From: Andy Whitcroft <apw@shadowen.org>

<valdis.kletnieks@vt.edu> reported that with -Wundef triggers warnings for
each use of mm.h, out of the flags fit code for SPARSEMEM.  Change this
check so that it uses the actually allocated flags widths rather than the
maxima for each.  This matches the original intent, adding the nodes field
if there is space and avoids the reference to SECTIONS_SHIFT which was
triggering the warning.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 include/linux/mm.h |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff -puN include/linux/mm.h~sparsemem-memory-model-fix-3 include/linux/mm.h
--- 25/include/linux/mm.h~sparsemem-memory-model-fix-3	2005-05-31 17:18:02.000000000 -0700
+++ 25-akpm/include/linux/mm.h	2005-05-31 17:18:02.000000000 -0700
@@ -412,12 +412,6 @@ static inline void put_page(struct page 
  * with space for node: | SECTION | NODE | ZONE | ... | FLAGS |
  *   no space for node: | SECTION |     ZONE    | ... | FLAGS |
  */
-#if SECTIONS_SHIFT+NODES_SHIFT+ZONES_SHIFT <= FLAGS_RESERVED
-#define NODES_WIDTH		NODES_SHIFT
-#else
-#define NODES_WIDTH		0
-#endif
-
 #ifdef CONFIG_SPARSEMEM
 #define SECTIONS_WIDTH		SECTIONS_SHIFT
 #else
@@ -426,6 +420,12 @@ static inline void put_page(struct page 
 
 #define ZONES_WIDTH		ZONES_SHIFT
 
+#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= FLAGS_RESERVED
+#define NODES_WIDTH		NODES_SHIFT
+#else
+#define NODES_WIDTH		0
+#endif
+
 /* Page flags: | [SECTION] | [NODE] | ZONE | ... | FLAGS | */
 #define SECTIONS_PGOFF		((sizeof(page_flags_t)*8) - SECTIONS_WIDTH)
 #define NODES_PGOFF		(SECTIONS_PGOFF - NODES_WIDTH)
_