Subject: Get rid of __ZONE_COUNT It was used to compensate because MAX_NR_ZONES was not available to the #ifdefs. Export MAX_NR_ZONES via the new mechanism and get rid of __ZONE_COUNT. Signed-off-by: Christoph Lameter --- include/linux/mmzone.h | 28 +++++++++++----------------- kernel/bounds.c | 1 + 2 files changed, 12 insertions(+), 17 deletions(-) Index: linux-2.6.25-rc3-mm1/include/linux/mmzone.h =================================================================== --- linux-2.6.25-rc3-mm1.orig/include/linux/mmzone.h 2008-03-07 16:07:50.044625678 -0800 +++ linux-2.6.25-rc3-mm1/include/linux/mmzone.h 2008-03-07 16:08:32.833291511 -0800 @@ -177,9 +177,16 @@ enum zone_type { ZONE_HIGHMEM, #endif ZONE_MOVABLE, - MAX_NR_ZONES + __MAX_NR_ZONES }; +#ifndef __GENERATING_BOUNDS_H +#include +#else +/* Dummy value to allow bounds.h creation to succeed */ +#define MAX_NR_ZONES 1 +#endif + /* * When a memory allocation must conform to specific limitations (such * as being suitable for DMA) the caller will pass in hints to the @@ -188,28 +195,15 @@ enum zone_type { * match the requested limits. See gfp_zone() in include/linux/gfp.h */ -/* - * Count the active zones. Note that the use of defined(X) outside - * #if and family is not necessarily defined so ensure we cannot use - * it later. Use __ZONE_COUNT to work out how many shift bits we need. - */ -#define __ZONE_COUNT ( \ - defined(CONFIG_ZONE_DMA) \ - + defined(CONFIG_ZONE_DMA32) \ - + 1 \ - + defined(CONFIG_HIGHMEM) \ - + 1 \ -) -#if __ZONE_COUNT < 2 +#if MAX_NR_ZONES < 2 #define ZONES_SHIFT 0 -#elif __ZONE_COUNT <= 2 +#elif MAX_NR_ZONES <= 2 #define ZONES_SHIFT 1 -#elif __ZONE_COUNT <= 4 +#elif MAX_NR_ZONES <= 4 #define ZONES_SHIFT 2 #else #error ZONES_SHIFT -- too many zones configured adjust calculation #endif -#undef __ZONE_COUNT struct zone { /* Fields commonly accessed by the page allocator */ Index: linux-2.6.25-rc3-mm1/kernel/bounds.c =================================================================== --- linux-2.6.25-rc3-mm1.orig/kernel/bounds.c 2008-03-07 16:07:50.044625678 -0800 +++ linux-2.6.25-rc3-mm1/kernel/bounds.c 2008-03-07 16:08:22.165125511 -0800 @@ -16,5 +16,6 @@ void foo(void) { /* The enum constants to put into include/linux/bounds.h */ DEFINE(NR_PAGEFLAGS, __NR_PAGEFLAGS); + DEFINE(MAX_NR_ZONES, __MAX_NR_ZONES); /* End of constants */ }