# \[PATCH 2/5\] Fix hugetlb\_basepage\_index missing prototype warning

- From: Matthew Wilcox (Oracle) \<willy@infradead.org\>
- Date: 2021-06-15 20:04:00 
- List: linux-mm
- Page: https://ratatoskr.run/linux-mm/2021/06/6508780
- Thread: https://ratatoskr.run/linux-mm/2021/06/6508778/t.md

```text
-Wmissing-prototypes requires that the prototype actually be in scope,
not just previously seen.  Move it outside page_to_pgoff().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/pagemap.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 5f0582de24e7..c4b1514818ff 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -585,16 +585,16 @@ static inline pgoff_t page_to_index(struct page *page)
 	return pgoff;
 }
 
+extern pgoff_t hugetlb_basepage_index(struct page *page);
+
 /*
  * Get the offset in PAGE_SIZE (even for hugetlb pages).
  * (TODO: hugetlb pages should have ->index in PAGE_SIZE)
  */
 static inline pgoff_t page_to_pgoff(struct page *page)
 {
-	if (unlikely(PageHuge(page))) {
-		extern pgoff_t hugetlb_basepage_index(struct page *page);
+	if (unlikely(PageHuge(page)))
 		return hugetlb_basepage_index(page);
-	}
 	return page_to_index(page);
 }
 
-- 
2.30.2


```
