Commit aa462abe authored by Ian Campbell's avatar Ian Campbell Committed by Linus Torvalds

mm: fix __page_to_pfn for a const struct page argument

This allows the cast in lowmem_page_address (introduced as a warning
fixup to 33dd4e0e "mm: make some struct page's const") to be
removed.

Propagate const'ness to page_to_section() as well since it is required
by __page_to_pfn.
Signed-off-by: default avatarIan Campbell <ian.campbell@citrix.com>
Acked-by: default avatarRik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f9918794
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
}) })
#define __page_to_pfn(pg) \ #define __page_to_pfn(pg) \
({ struct page *__pg = (pg); \ ({ const struct page *__pg = (pg); \
struct pglist_data *__pgdat = NODE_DATA(page_to_nid(__pg)); \ struct pglist_data *__pgdat = NODE_DATA(page_to_nid(__pg)); \
(unsigned long)(__pg - __pgdat->node_mem_map) + \ (unsigned long)(__pg - __pgdat->node_mem_map) + \
__pgdat->node_start_pfn; \ __pgdat->node_start_pfn; \
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
* section[i].section_mem_map == mem_map's address - start_pfn; * section[i].section_mem_map == mem_map's address - start_pfn;
*/ */
#define __page_to_pfn(pg) \ #define __page_to_pfn(pg) \
({ struct page *__pg = (pg); \ ({ const struct page *__pg = (pg); \
int __sec = page_to_section(__pg); \ int __sec = page_to_section(__pg); \
(unsigned long)(__pg - __section_mem_map_addr(__nr_to_section(__sec))); \ (unsigned long)(__pg - __section_mem_map_addr(__nr_to_section(__sec))); \
}) })
......
...@@ -685,7 +685,7 @@ static inline void set_page_section(struct page *page, unsigned long section) ...@@ -685,7 +685,7 @@ static inline void set_page_section(struct page *page, unsigned long section)
page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
} }
static inline unsigned long page_to_section(struct page *page) static inline unsigned long page_to_section(const struct page *page)
{ {
return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
} }
...@@ -720,7 +720,7 @@ static inline void set_page_links(struct page *page, enum zone_type zone, ...@@ -720,7 +720,7 @@ static inline void set_page_links(struct page *page, enum zone_type zone,
static __always_inline void *lowmem_page_address(const struct page *page) static __always_inline void *lowmem_page_address(const struct page *page)
{ {
return __va(PFN_PHYS(page_to_pfn((struct page *)page))); return __va(PFN_PHYS(page_to_pfn(page)));
} }
#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) #if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment