public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <dave@linux.vnet.ibm.com>
To: linux-arch@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Dave Hansen <dave@linux.vnet.ibm.com>
Subject: [RFC v2][PATCH 28/35] mips: use pte_offset_kernel() as base for pte_offset_map*()
Date: Wed, 20 May 2009 11:25:29 -0700	[thread overview]
Message-ID: <20090520182529.0B43B8BD@kernel> (raw)
In-Reply-To: <20090520182445.D7B49A7C@kernel>


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 <dave@linux.vnet.ibm.com>
---

 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 <asm/ptemap.h>
 
 #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 <asm/ptemap.h>
 /*
  * 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 */
_

  parent reply	other threads:[~2009-05-20 18:31 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-20 18:24 [RFC v2][PATCH 00/35] consolidate pte mapping functions across all architectures Dave Hansen
2009-05-20 18:24 ` [RFC v2][PATCH 01/35] rename arm and frv's __pte_index() Dave Hansen
2009-05-20 18:24 ` [RFC v2][PATCH 02/35] rework sparc pte functions to be consistent with other arches Dave Hansen
2009-05-20 18:24 ` [RFC v2][PATCH 03/35] alpha: create ptemap.h Dave Hansen
2009-05-20 18:24 ` [RFC v2][PATCH 04/35] arm: " Dave Hansen
2009-05-20 18:24 ` [RFC v2][PATCH 05/35] avr32: " Dave Hansen
2009-05-20 18:24 ` [RFC v2][PATCH 06/35] cris: " Dave Hansen
2009-05-20 18:24 ` [RFC v2][PATCH 07/35] frv: " Dave Hansen
2009-05-20 18:24 ` [RFC v2][PATCH 08/35] ia64: " Dave Hansen
2009-05-20 18:24 ` [RFC v2][PATCH 09/35] m32r: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 10/35] m68k: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 11/35] mips: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 12/35] mn10300: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 13/35] parisc: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 14/35] powerpc: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 15/35] s390: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 16/35] sh: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 17/35] sparc: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 18/35] um: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 19/35] x86: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 20/35] xtensa: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 21/35] create linux/ptemap.h for arch-independent pte mapping funcs Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 22/35] include linux/ptemap.h at all use sites Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 23/35] factor x86 pte mapping code Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 24/35] arm: use pte_offset_kernel() as base for pte_offset_map*() Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 25/35] cris: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 26/35] frv: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 27/35] m32r: " Dave Hansen
2009-05-20 18:25 ` Dave Hansen [this message]
2009-05-20 18:25 ` [RFC v2][PATCH 29/35] um: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 30/35] m68k: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 31/35] mn10300: " Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 32/35] Move users to asm-generic/ptemap.h Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 33/35] asm-generic/ptemap.h for HIGHPTE implementations Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 34/35] powerpc use generic ptemap.h Dave Hansen
2009-05-20 18:25 ` [RFC v2][PATCH 35/35] remove old ptemap.h includes Dave Hansen
2009-05-20 22:06 ` [RFC v2][PATCH 00/35] consolidate pte mapping functions across all architectures Jeremy Fitzhardinge
2009-05-20 22:38   ` Dave Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090520182529.0B43B8BD@kernel \
    --to=dave@linux.vnet.ibm.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox