summaryrefslogtreecommitdiff
path: root/arch/nios2
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2016-11-09 12:17:41 +0300
committerLey Foon Tan <ley.foon.tan@intel.com>2016-12-13 12:13:17 +0300
commit863cf8da0f32a4c822cd9f7a2f47cd5204ce1ca0 (patch)
treed62c459fa0e839a993ee9ef09f6ae66155767641 /arch/nios2
parent3c98fd266b76e04fd59d294f2fb588cc5cb4c212 (diff)
downloadlinux-863cf8da0f32a4c822cd9f7a2f47cd5204ce1ca0.tar.xz
nios2: Convert pfn_valid to static inline
When compiling with 'W=1' warnings such as the following occur all over the place: ./include/linux/pfn.h:21:22: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] which is due to ARCH_PFN_OFFSET being 0 by default (if CONFIG_NIOS2_MEM_BASE is not changed in the Kconfig). Fix these warnings by making pfn_valid a static inline function. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Diffstat (limited to 'arch/nios2')
-rw-r--r--arch/nios2/include/asm/page.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/nios2/include/asm/page.h b/arch/nios2/include/asm/page.h
index 74477ab66f65..f1fbdc47bdaf 100644
--- a/arch/nios2/include/asm/page.h
+++ b/arch/nios2/include/asm/page.h
@@ -85,8 +85,15 @@ extern struct page *mem_map;
((void *)(((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
# define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
-# define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && \
- (pfn) < max_mapnr)
+
+static inline bool pfn_valid(unsigned long pfn)
+{
+ /* avoid <linux/mm.h> include hell */
+ extern unsigned long max_mapnr;
+ unsigned long pfn_offset = ARCH_PFN_OFFSET;
+
+ return pfn >= pfn_offset && pfn < max_mapnr;
+}
# define virt_to_page(vaddr) pfn_to_page(PFN_DOWN(virt_to_phys(vaddr)))
# define virt_addr_valid(vaddr) pfn_valid(PFN_DOWN(virt_to_phys(vaddr)))