Commit baf922780251d12bc1c24c83df60c4c278abb745
1 parent
01a6221a6a
Exists in
master
and in
7 other branches
MIPS: Fix CONFIG_FLATMEM version of pfn_valid()
For systems which do not define PHYS_OFFSET as 0 pfn_valid() may falsely have returned 0 on most configurations. Bug introduced by commit 752fbeb2e3555c0d236e992f1195fd7ce30e728d (linux-mips.org) rsp. 6f284a2ce7b8bc49cb8455b1763357897a899abb (kernel.org) titled "[MIPS] FLATMEM: introduce PHYS_OFFSET." Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Showing 1 changed file with 8 additions and 1 deletions Side-by-side Diff
arch/mips/include/asm/page.h
... | ... | @@ -165,7 +165,14 @@ |
165 | 165 | |
166 | 166 | #ifdef CONFIG_FLATMEM |
167 | 167 | |
168 | -#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && (pfn) < max_mapnr) | |
168 | +#define pfn_valid(pfn) \ | |
169 | +({ \ | |
170 | + unsigned long __pfn = (pfn); \ | |
171 | + /* avoid <linux/bootmem.h> include hell */ \ | |
172 | + extern unsigned long min_low_pfn; \ | |
173 | + \ | |
174 | + __pfn >= min_low_pfn && __pfn < max_mapnr; \ | |
175 | +}) | |
169 | 176 | |
170 | 177 | #elif defined(CONFIG_SPARSEMEM) |
171 | 178 |