MIPS: Fix CONFIG_FLATMEM version of pfn_valid()

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git-commits-head@...>
Date: Saturday, July 4, 2009 - 1:59 pm

Gitweb:     http://git.kernel.org/linus/baf922780251d12bc1c24c83df60c4c278abb745
Commit:     baf922780251d12bc1c24c83df60c4c278abb745
Parent:     01a6221a6a51ec47b9ae3ed42c396f98dd488c7e
Author:     Ralf Baechle <ralf@linux-mips.org>
AuthorDate: Fri Jul 3 07:11:15 2009 +0100
Committer:  Ralf Baechle <ralf@linux-mips.org>
CommitDate: Fri Jul 3 15:45:29 2009 +0100

    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>
---
 arch/mips/include/asm/page.h |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index dc0eaa7..96a14a4 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -165,7 +165,14 @@ typedef struct { unsigned long pgprot; } pgprot_t;
 
 #ifdef CONFIG_FLATMEM
 
-#define pfn_valid(pfn)		((pfn) >= ARCH_PFN_OFFSET && (pfn) < max_mapnr)
+#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;			\
+})
 
 #elif defined(CONFIG_SPARSEMEM)
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
MIPS: Fix CONFIG_FLATMEM version of pfn_valid(), Linux Kernel Mailing List..., (Sat Jul 4, 1:59 pm)