MIPS: Rewrite pfn_valid to work in modules, too.
authorRalf Baechle <ralf@linux-mips.org>
Sat, 18 May 2013 15:02:59 +0000 (17:02 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Sun, 19 May 2013 07:56:58 +0000 (09:56 +0200)
This fixes:

  MODPOST 393 modules
ERROR: "min_low_pfn" [arch/mips/kvm/kvm.ko] undefined!
make[3]: *** [__modpost] Error 1

It would have been possible to just export min_low_pfn but in the end
pfn_valid should return 1 for any pfn argument for which a struct page
exists so using min_low_pfn was wrong anyway.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/page.h

index ec1ca537fbc1b6ac3f04b4f0c4f1b6b9c24f600a..f59552fae9173264ab58ffd3fbe95e080ec5db93 100644 (file)
@@ -171,14 +171,13 @@ typedef struct { unsigned long pgprot; } pgprot_t;
 
 #ifdef CONFIG_FLATMEM
 
-#define pfn_valid(pfn)                                                 \
-({                                                                     \
-       unsigned long __pfn = (pfn);                                    \
-       /* avoid <linux/bootmem.h> include hell */                      \
-       extern unsigned long min_low_pfn;                               \
-                                                                       \
-       __pfn >= min_low_pfn && __pfn < max_mapnr;                      \
-})
+static inline int pfn_valid(unsigned long pfn)
+{
+       /* avoid <linux/mm.h> include hell */
+       extern unsigned long max_mapnr;
+
+       return pfn >= ARCH_PFN_OFFSET && pfn < max_mapnr;
+}
 
 #elif defined(CONFIG_SPARSEMEM)