<linux/mm{,zone}.h> const
PATCH 1/1 <linux/mm{,zone}.h> const
Make input parameters const where possible.
Signed-off-by Geert Uytterhoeven <[email protected]>
include/linux/mm.h +6 -6
@@ -373,11 +373,11 @@#define NODEZONE_SHIFT (sizeof(page_flags_t)*8 - MAX_NODES_SHIFT - MAX_ZONES_SHIFT)#define NODEZONE (node, zone) ((node << ZONES_SHIFT) | zone) -static inline unsigned long page_zonenum (struct page *page) +static inline unsigned long page_zonenum (const struct page *page) {return (page->flags >>NODEZONE_SHIFT ) & (~(~0UL <<ZONES_SHIFT )); } -static inline unsigned long page_to_nid (struct page *page) +static inline unsigned long page_to_nid (const struct page *page) {return (page->flags >> (NODEZONE_SHIFT +ZONES_SHIFT )); }
@@ -385,7 +385,7 @@struct zone ;extern struct zone *zone_table[]; -static inline struct zone *page_zone (struct page *page) +static inline struct zone *page_zone (const struct page *page) {return zone_table[page->flags >>NODEZONE_SHIFT ]; }
@@ -401,7 +401,7 @@extern struct page *mem_map;#endif -static inline void *lowmem_page_address (struct page *page) +static inline void *lowmem_page_address (const struct page *page) {return __va (page_to_pfn (page) <<PAGE_SHIFT ); }
@@ -455,7 +455,7 @@* Return the pagecache index of the passed page. Regular pagecache pages * use ->index whereas swapcache pages use ->private */ -static inline pgoff_t page_index (struct page *page) +static inline pgoff_t page_index (const struct page *page) {if (unlikely (PageSwapCache (page)))return page->private;
@@ -465,7 +465,7 @@/* * Return true if this page is mapped into pagetables. */ -static inline int page_mapped (struct page *page) +static inline int page_mapped (const struct page *page) {return page->mapcount !=0 ; }
include/linux/mmzone.h +2 -2
@@ -360,20 +360,29 @@* to ZONE_{DMA/NORMAL/HIGHMEM/etc} in general code to a minimum. * @zone - pointer to struct zone variable */ -static inline int is_highmem (struct zone *zone) +static inline int is_highmem (const struct zone *zone) {return (zone - zone->zone_pgdat->node_zones ==ZONE_HIGHMEM ); } -static inline int is_normal (struct zone *zone) +static inline int is_normal (const struct zone *zone) {return (zone - zone->zone_pgdat->node_zones ==ZONE_NORMAL ); }/* These two functions are used to setup the per zone pages min values */
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds