From: Andrew Morton Date: Thu, 23 May 2013 00:37:21 +0000 (+1000) Subject: include/linux/mmzone.h: cleanups X-Git-Tag: next-20130527~1^2~186 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7ba80bd54e820991aa074a13369f216cc8505388;p=karo-tx-linux.git include/linux/mmzone.h: cleanups - implement zone_idx() in C to fix its references-args-twice macro bug - use zone_idx() in is_highmem() to remove large amounts of silly fluff. Cc: Lin Feng Cc: Mel Gorman Signed-off-by: Andrew Morton --- diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index e511f9429f1e..a9296055976b 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -835,7 +835,10 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long); /* * zone_idx() returns 0 for the ZONE_DMA zone, 1 for the ZONE_NORMAL zone, etc. */ -#define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones) +static inline enum zone_type zone_idx(struct zone *zone) +{ + return zone - zone->zone_pgdat->node_zones; +} static inline int populated_zone(struct zone *zone) { @@ -877,10 +880,10 @@ static inline int is_normal_idx(enum zone_type idx) static inline int is_highmem(struct zone *zone) { #ifdef CONFIG_HIGHMEM - int zone_off = (char *)zone - (char *)zone->zone_pgdat->node_zones; - return zone_off == ZONE_HIGHMEM * sizeof(*zone) || - (zone_off == ZONE_MOVABLE * sizeof(*zone) && - zone_movable_is_highmem()); + enum zone_type idx = zone_idx(zone); + + return idx == ZONE_HIGHMEM || + (idx == ZONE_MOVABLE && zone_movable_is_highmem()); #else return 0; #endif