From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765113AbZEAO4a (ORCPT ); Fri, 1 May 2009 10:56:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1761735AbZEAOmw (ORCPT ); Fri, 1 May 2009 10:42:52 -0400 Received: from e3.ny.us.ibm.com ([32.97.182.143]:58343 "EHLO e3.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761365AbZEAOmq (ORCPT ); Fri, 1 May 2009 10:42:46 -0400 Subject: [RFC][PATCH 28/35] mips: use pte_offset_kernel() as base for pte_offset_map*() To: linux-arch@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Dave Hansen From: Dave Hansen Date: Fri, 01 May 2009 07:42:45 -0700 References: <20090501144201.D31EF417@kernel> In-Reply-To: <20090501144201.D31EF417@kernel> Message-Id: <20090501144245.4BB57D7C@kernel> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some architectures use pte_offset_map() as a basis for pte_offset_kernel(). Others do the inverse. Although arbitrary, Using pte_offset_kernel() as the base seems a wee bit more popular and it also fits in well with the way I'm breaking out the headers. Instead of coding the same implementation twice, this makes pte_offset_map{,_nested}() call pte_offset_kernel() directly. On MIPS, it is also obvious at this point that the 32 and 64-bit implementations are identical. Coalesce them. Signed-off-by: Dave Hansen --- linux-2.6.git-dave/arch/mips/include/asm/pgtable-32.h | 3 +-- linux-2.6.git-dave/arch/mips/include/asm/pgtable-64.h | 3 +-- linux-2.6.git-dave/arch/mips/include/asm/ptemap.h | 17 ++--------------- 3 files changed, 4 insertions(+), 19 deletions(-) diff -puN arch/mips/include/asm/pgtable-32.h~mips-pte_offset_kernel arch/mips/include/asm/pgtable-32.h --- linux-2.6.git/arch/mips/include/asm/pgtable-32.h~mips-pte_offset_kernel 2009-04-30 15:11:09.000000000 -0700 +++ linux-2.6.git-dave/arch/mips/include/asm/pgtable-32.h 2009-04-30 15:11:09.000000000 -0700 @@ -149,8 +149,7 @@ pfn_pte(unsigned long pfn, pgprot_t prot (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) #define pte_offset(dir, address) \ ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) -#define pte_offset_kernel(dir, address) \ - ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) +#define pte_offset_kernel(dir, address) pte_offset(dir, address) #include #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) diff -puN arch/mips/include/asm/pgtable-64.h~mips-pte_offset_kernel arch/mips/include/asm/pgtable-64.h --- linux-2.6.git/arch/mips/include/asm/pgtable-64.h~mips-pte_offset_kernel 2009-04-30 15:11:09.000000000 -0700 +++ linux-2.6.git-dave/arch/mips/include/asm/pgtable-64.h 2009-04-30 15:11:09.000000000 -0700 @@ -213,8 +213,7 @@ static inline pmd_t *pmd_offset(pud_t * (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) #define pte_offset(dir, address) \ ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) -#define pte_offset_kernel(dir, address) \ - ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) +#define pte_offset_kernel(dir, address) pte_offset(dir, address) #include /* * Initialize a new pgd / pmd table with invalid pointers. diff -puN arch/mips/include/asm/ptemap.h~mips-pte_offset_kernel arch/mips/include/asm/ptemap.h --- linux-2.6.git/arch/mips/include/asm/ptemap.h~mips-pte_offset_kernel 2009-04-30 15:11:09.000000000 -0700 +++ linux-2.6.git-dave/arch/mips/include/asm/ptemap.h 2009-04-30 15:11:09.000000000 -0700 @@ -1,22 +1,9 @@ #ifndef _MIPS_ASM_PTEMAP_H #define _MIPS_ASM_PTEMAP_H -#ifdef CONFIG_32BIT -#define pte_offset_map(dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) -#define pte_offset_map_nested(dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) +#define pte_offset_map(dir, address) pte_offset_kernel(dir, address) +#define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address) #define pte_unmap(pte) ((void)(pte)) #define pte_unmap_nested(pte) ((void)(pte)) -#endif - -#ifdef CONFIG_64BIT -#define pte_offset_map(dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) -#define pte_offset_map_nested(dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) -#define pte_unmap(pte) ((void)(pte)) -#define pte_unmap_nested(pte) ((void)(pte)) -#endif #endif /* _MIPS_ASM_PTEMAP_H */ _