x86: unify pte_index
authorJeremy Fitzhardinge <jeremy@goop.org>
Thu, 5 Feb 2009 19:31:06 +0000 (11:31 -0800)
committerJeremy Fitzhardinge <jeremy@goop.org>
Fri, 6 Feb 2009 20:31:50 +0000 (12:31 -0800)
Impact: cleanup

Unify and demacro pte_index.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
arch/x86/include/asm/pgtable.h
arch/x86/include/asm/pgtable_32.h
arch/x86/include/asm/pgtable_64.h

index 49b5cff78c285a14fbd47a44097b8b09a5ac3d60..10a8c2e517896d936bb92734033f18e739eac9a2 100644 (file)
@@ -498,6 +498,17 @@ static inline unsigned pmd_index(unsigned long address)
  */
 #define mk_pte(page, pgprot)   pfn_pte(page_to_pfn(page), (pgprot))
 
+/*
+ * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE]
+ *
+ * this function returns the index of the entry in the pte page which would
+ * control the given virtual address
+ */
+static inline unsigned pte_index(unsigned long address)
+{
+       return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1);
+}
+
 #if PAGETABLE_LEVELS > 2
 static inline int pud_present(pud_t pud)
 {
index 6335be843c16e4b245b4079ea489e621025df984..00d298e14a8f2eb40603e06f70d2fdcd9d44256d 100644 (file)
@@ -97,14 +97,6 @@ extern unsigned long pg0[];
 
 static inline int pud_large(pud_t pud) { return 0; }
 
-/*
- * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE]
- *
- * this macro returns the index of the entry in the pte page which would
- * control the given virtual address
- */
-#define pte_index(address)                                     \
-       (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 #define pte_offset_kernel(dir, address)                                \
        ((pte_t *)pmd_page_vaddr(*(dir)) +  pte_index((address)))
 
index adce05628a01167208fd61392dbc26d7f918a58e..e7321bc8aa81c884ccbfab8afd526470157d82ce 100644 (file)
@@ -198,7 +198,6 @@ static inline int pud_large(pud_t pte)
 
 /* PTE - Level 1 access. */
 
-#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 #define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + \
                                         pte_index((address)))