Skip to contentSkip to conversation

asm-i386/mmzone.h oddness.

PATCH New Dave Jones 1 participant 3 messages Jul 1, 2005

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

I was wondering why the rawhide gcc (4.0.0 20050622 (Red Hat 4.0.0-13)) blew up whilst trying to compile -rc3 and newer, with this informative error..

include/asm/mmzone.h:154: error: syntax error before numeric constant

So I dug around, and I've not yet tested my theory, but this looks just.. wrong.

#if CONFIG_NUMA
extern struct pglist_data *node_data[];
#define NODE_DATA(nid) (node_data[nid])

#ifdef CONFIG_NUMA

The first #if used to be a #ifdef CONFIG_DISCONTIGMEM, which made a little more sense to me, but I don't fully understand the recent changes yet.

Anyone have clues ?

Dave

author
#1 lore raw

PATCH 1/1 Clean up numa defines in mmzone.h

Quoted 7 lines · Dave Jones

this looks just.. wrong.

#if CONFIG_NUMA
extern struct pglist_data *node_data[];
#define NODE_DATA(nid) (node_data[nid])

#ifdef CONFIG_NUMA

This patch cleans this stuff up. The compile failure I saw is fixed in the followup patch.

include/asm-i386/mmzone.h renamed from include/asm-i386/mmzone.h~ +9 -11
@@ -8,20 +8,15 @@
 
 #include <asm/smp.h>
 
-#if CONFIG_NUMA
+#ifdef CONFIG_NUMA
 extern struct pglist_data *node_data[];
 #define NODE_DATA(nid)	(node_data[nid])
 
-#ifdef CONFIG_NUMA
-	#ifdef CONFIG_X86_NUMAQ
-		#include <asm/numaq.h>
-	#else	/* summit or generic arch */
-		#include <asm/srat.h>
-	#endif
-#else /* !CONFIG_NUMA */
-	#define get_memcfg_numa get_memcfg_numa_flat
-	#define get_zholes_size(n) (0)
-#endif /* CONFIG_NUMA */
+#ifdef CONFIG_X86_NUMAQ
+	#include <asm/numaq.h>
+#else	/* summit or generic arch */
+	#include <asm/srat.h>
+#endif
 
 extern int get_memcfg_numa_flat(void );
 /*
@@ -42,6 +37,9 @@ static inline void get_memcfg_numa(void)
 	get_memcfg_numa_flat();
 }
 
+#else /* !CONFIG_NUMA */
+#define get_memcfg_numa get_memcfg_numa_flat
+#define get_zholes_size(n) (0)
 #endif /* CONFIG_NUMA */
 
 #ifdef CONFIG_DISCONTIGMEM
author
#2 lore raw

PATCH 1/1 Fix up non-NUMA breakage in mmzone.h

In reply to Dave Jones
Quoted 5 lines · Dave Jones

I was wondering why the rawhide gcc (4.0.0 20050622 (Red Hat 4.0.0-13)) blew up whilst trying to compile -rc3 and newer, with this informative error..

include/asm/mmzone.h:154: error: syntax error before numeric constant

If CONFIG_NUMA isn't set, we use the define in <linux/mmzone.h> for early_pfn_to_nid (which defines it to 0).

Because of this, the prototype needs to move inside the CONFIG_NUMA too, or anal gcc's get really confused.

include/asm-i386/mmzone.h renamed from include/asm-i386/mmzone.h~ +2 -2
@@ -37,6 +37,8 @@ static inline void get_memcfg_numa(void)
 	get_memcfg_numa_flat();
 }
 
+extern int early_pfn_to_nid(unsigned long pfn);
+
 #else /* !CONFIG_NUMA */
 #define get_memcfg_numa get_memcfg_numa_flat
 #define get_zholes_size(n) (0)
@@ -149,6 +151,4 @@ static inline int pfn_valid(int pfn)
 
 #endif /* CONFIG_NEED_MULTIPLE_NODES */
 
-extern int early_pfn_to_nid(unsigned long pfn);
-
 #endif /* _ASM_MMZONE_H_ */