diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2005-09-03 18:54:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@evo.osdl.org> | 2005-09-05 03:05:39 -0400 |
commit | fd4fd5aac1282825195c6816ed40a2a6d42db5bf (patch) | |
tree | 5908cf4c88a7c9d69ea7bdc1c354d51b6ff47f86 /include | |
parent | 28ae55c98e4d16eac9a05a8a259d7763ef3aeb18 (diff) |
[PATCH] mm: consolidate get_order
Someone mentioned that almost all the architectures used basically the same
implementation of get_order. This patch consolidates them into
asm-generic/page.h and includes that in the appropriate places. The
exceptions are ia64 and ppc which have their own (presumably optimised)
versions.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-alpha/page.h | 16 | ||||
-rw-r--r-- | include/asm-arm/page.h | 16 | ||||
-rw-r--r-- | include/asm-arm26/page.h | 16 | ||||
-rw-r--r-- | include/asm-cris/page.h | 15 | ||||
-rw-r--r-- | include/asm-frv/page.h | 17 | ||||
-rw-r--r-- | include/asm-generic/page.h | 26 | ||||
-rw-r--r-- | include/asm-h8300/page.h | 16 | ||||
-rw-r--r-- | include/asm-i386/page.h | 16 | ||||
-rw-r--r-- | include/asm-m32r/page.h | 21 | ||||
-rw-r--r-- | include/asm-m68k/page.h | 16 | ||||
-rw-r--r-- | include/asm-m68knommu/page.h | 16 | ||||
-rw-r--r-- | include/asm-mips/page.h | 16 | ||||
-rw-r--r-- | include/asm-parisc/page.h | 16 | ||||
-rw-r--r-- | include/asm-ppc64/page.h | 17 | ||||
-rw-r--r-- | include/asm-s390/page.h | 16 | ||||
-rw-r--r-- | include/asm-sh/page.h | 20 | ||||
-rw-r--r-- | include/asm-sh64/page.h | 20 | ||||
-rw-r--r-- | include/asm-sparc/page.h | 16 | ||||
-rw-r--r-- | include/asm-sparc64/page.h | 16 | ||||
-rw-r--r-- | include/asm-um/page.h | 16 | ||||
-rw-r--r-- | include/asm-v850/page.h | 21 | ||||
-rw-r--r-- | include/asm-x86_64/page.h | 16 |
22 files changed, 69 insertions, 312 deletions
diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h index 0577daffc720..fa0b41b164a7 100644 --- a/include/asm-alpha/page.h +++ b/include/asm-alpha/page.h | |||
@@ -63,20 +63,6 @@ typedef unsigned long pgprot_t; | |||
63 | 63 | ||
64 | #endif /* STRICT_MM_TYPECHECKS */ | 64 | #endif /* STRICT_MM_TYPECHECKS */ |
65 | 65 | ||
66 | /* Pure 2^n version of get_order */ | ||
67 | extern __inline__ int get_order(unsigned long size) | ||
68 | { | ||
69 | int order; | ||
70 | |||
71 | size = (size-1) >> (PAGE_SHIFT-1); | ||
72 | order = -1; | ||
73 | do { | ||
74 | size >>= 1; | ||
75 | order++; | ||
76 | } while (size); | ||
77 | return order; | ||
78 | } | ||
79 | |||
80 | #ifdef USE_48_BIT_KSEG | 66 | #ifdef USE_48_BIT_KSEG |
81 | #define PAGE_OFFSET 0xffff800000000000UL | 67 | #define PAGE_OFFSET 0xffff800000000000UL |
82 | #else | 68 | #else |
@@ -112,4 +98,6 @@ extern __inline__ int get_order(unsigned long size) | |||
112 | 98 | ||
113 | #endif /* __KERNEL__ */ | 99 | #endif /* __KERNEL__ */ |
114 | 100 | ||
101 | #include <asm-generic/page.h> | ||
102 | |||
115 | #endif /* _ALPHA_PAGE_H */ | 103 | #endif /* _ALPHA_PAGE_H */ |
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h index 019c45d75730..4da1d532cbeb 100644 --- a/include/asm-arm/page.h +++ b/include/asm-arm/page.h | |||
@@ -163,20 +163,6 @@ typedef unsigned long pgprot_t; | |||
163 | /* the upper-most page table pointer */ | 163 | /* the upper-most page table pointer */ |
164 | extern pmd_t *top_pmd; | 164 | extern pmd_t *top_pmd; |
165 | 165 | ||
166 | /* Pure 2^n version of get_order */ | ||
167 | static inline int get_order(unsigned long size) | ||
168 | { | ||
169 | int order; | ||
170 | |||
171 | size = (size-1) >> (PAGE_SHIFT-1); | ||
172 | order = -1; | ||
173 | do { | ||
174 | size >>= 1; | ||
175 | order++; | ||
176 | } while (size); | ||
177 | return order; | ||
178 | } | ||
179 | |||
180 | #include <asm/memory.h> | 166 | #include <asm/memory.h> |
181 | 167 | ||
182 | #endif /* !__ASSEMBLY__ */ | 168 | #endif /* !__ASSEMBLY__ */ |
@@ -186,4 +172,6 @@ static inline int get_order(unsigned long size) | |||
186 | 172 | ||
187 | #endif /* __KERNEL__ */ | 173 | #endif /* __KERNEL__ */ |
188 | 174 | ||
175 | #include <asm-generic/page.h> | ||
176 | |||
189 | #endif | 177 | #endif |
diff --git a/include/asm-arm26/page.h b/include/asm-arm26/page.h index c334079b082b..d3f23ac4d468 100644 --- a/include/asm-arm26/page.h +++ b/include/asm-arm26/page.h | |||
@@ -89,20 +89,6 @@ typedef unsigned long pgprot_t; | |||
89 | #ifdef __KERNEL__ | 89 | #ifdef __KERNEL__ |
90 | #ifndef __ASSEMBLY__ | 90 | #ifndef __ASSEMBLY__ |
91 | 91 | ||
92 | /* Pure 2^n version of get_order */ | ||
93 | static inline int get_order(unsigned long size) | ||
94 | { | ||
95 | int order; | ||
96 | |||
97 | size = (size-1) >> (PAGE_SHIFT-1); | ||
98 | order = -1; | ||
99 | do { | ||
100 | size >>= 1; | ||
101 | order++; | ||
102 | } while (size); | ||
103 | return order; | ||
104 | } | ||
105 | |||
106 | #include <asm/memory.h> | 92 | #include <asm/memory.h> |
107 | 93 | ||
108 | #endif /* !__ASSEMBLY__ */ | 94 | #endif /* !__ASSEMBLY__ */ |
@@ -112,4 +98,6 @@ static inline int get_order(unsigned long size) | |||
112 | 98 | ||
113 | #endif /* __KERNEL__ */ | 99 | #endif /* __KERNEL__ */ |
114 | 100 | ||
101 | #include <asm-generic/page.h> | ||
102 | |||
115 | #endif | 103 | #endif |
diff --git a/include/asm-cris/page.h b/include/asm-cris/page.h index bbf17bd39385..c99c478c482f 100644 --- a/include/asm-cris/page.h +++ b/include/asm-cris/page.h | |||
@@ -70,19 +70,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
70 | 70 | ||
71 | #ifndef __ASSEMBLY__ | 71 | #ifndef __ASSEMBLY__ |
72 | 72 | ||
73 | /* Pure 2^n version of get_order */ | ||
74 | static inline int get_order(unsigned long size) | ||
75 | { | ||
76 | int order; | ||
77 | |||
78 | size = (size-1) >> (PAGE_SHIFT-1); | ||
79 | order = -1; | ||
80 | do { | ||
81 | size >>= 1; | ||
82 | order++; | ||
83 | } while (size); | ||
84 | return order; | ||
85 | } | ||
86 | #endif /* __ASSEMBLY__ */ | 73 | #endif /* __ASSEMBLY__ */ |
87 | 74 | ||
88 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | 75 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ |
@@ -90,5 +77,7 @@ static inline int get_order(unsigned long size) | |||
90 | 77 | ||
91 | #endif /* __KERNEL__ */ | 78 | #endif /* __KERNEL__ */ |
92 | 79 | ||
80 | #include <asm-generic/page.h> | ||
81 | |||
93 | #endif /* _CRIS_PAGE_H */ | 82 | #endif /* _CRIS_PAGE_H */ |
94 | 83 | ||
diff --git a/include/asm-frv/page.h b/include/asm-frv/page.h index f7914f1782b0..4feba567e7fd 100644 --- a/include/asm-frv/page.h +++ b/include/asm-frv/page.h | |||
@@ -45,21 +45,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
45 | /* to align the pointer to the (next) page boundary */ | 45 | /* to align the pointer to the (next) page boundary */ |
46 | #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) | 46 | #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) |
47 | 47 | ||
48 | /* Pure 2^n version of get_order */ | ||
49 | static inline int get_order(unsigned long size) __attribute_const__; | ||
50 | static inline int get_order(unsigned long size) | ||
51 | { | ||
52 | int order; | ||
53 | |||
54 | size = (size - 1) >> (PAGE_SHIFT - 1); | ||
55 | order = -1; | ||
56 | do { | ||
57 | size >>= 1; | ||
58 | order++; | ||
59 | } while (size); | ||
60 | return order; | ||
61 | } | ||
62 | |||
63 | #define devmem_is_allowed(pfn) 1 | 48 | #define devmem_is_allowed(pfn) 1 |
64 | 49 | ||
65 | #define __pa(vaddr) virt_to_phys((void *) vaddr) | 50 | #define __pa(vaddr) virt_to_phys((void *) vaddr) |
@@ -102,4 +87,6 @@ extern unsigned long max_pfn; | |||
102 | #define WANT_PAGE_VIRTUAL 1 | 87 | #define WANT_PAGE_VIRTUAL 1 |
103 | #endif | 88 | #endif |
104 | 89 | ||
90 | #include <asm-generic/page.h> | ||
91 | |||
105 | #endif /* _ASM_PAGE_H */ | 92 | #endif /* _ASM_PAGE_H */ |
diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h new file mode 100644 index 000000000000..a96b5d986b6e --- /dev/null +++ b/include/asm-generic/page.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef _ASM_GENERIC_PAGE_H | ||
2 | #define _ASM_GENERIC_PAGE_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | #ifndef __ASSEMBLY__ | ||
6 | |||
7 | #include <linux/compiler.h> | ||
8 | |||
9 | /* Pure 2^n version of get_order */ | ||
10 | static __inline__ __attribute_const__ int get_order(unsigned long size) | ||
11 | { | ||
12 | int order; | ||
13 | |||
14 | size = (size - 1) >> (PAGE_SHIFT - 1); | ||
15 | order = -1; | ||
16 | do { | ||
17 | size >>= 1; | ||
18 | order++; | ||
19 | } while (size); | ||
20 | return order; | ||
21 | } | ||
22 | |||
23 | #endif /* __ASSEMBLY__ */ | ||
24 | #endif /* __KERNEL__ */ | ||
25 | |||
26 | #endif /* _ASM_GENERIC_PAGE_H */ | ||
diff --git a/include/asm-h8300/page.h b/include/asm-h8300/page.h index e3b7960d445b..e8c02b8c2d99 100644 --- a/include/asm-h8300/page.h +++ b/include/asm-h8300/page.h | |||
@@ -54,20 +54,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
54 | /* to align the pointer to the (next) page boundary */ | 54 | /* to align the pointer to the (next) page boundary */ |
55 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) | 55 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) |
56 | 56 | ||
57 | /* Pure 2^n version of get_order */ | ||
58 | extern __inline__ int get_order(unsigned long size) | ||
59 | { | ||
60 | int order; | ||
61 | |||
62 | size = (size-1) >> (PAGE_SHIFT-1); | ||
63 | order = -1; | ||
64 | do { | ||
65 | size >>= 1; | ||
66 | order++; | ||
67 | } while (size); | ||
68 | return order; | ||
69 | } | ||
70 | |||
71 | extern unsigned long memory_start; | 57 | extern unsigned long memory_start; |
72 | extern unsigned long memory_end; | 58 | extern unsigned long memory_end; |
73 | 59 | ||
@@ -101,4 +87,6 @@ extern unsigned long memory_end; | |||
101 | 87 | ||
102 | #endif /* __KERNEL__ */ | 88 | #endif /* __KERNEL__ */ |
103 | 89 | ||
90 | #include <asm-generic/page.h> | ||
91 | |||
104 | #endif /* _H8300_PAGE_H */ | 92 | #endif /* _H8300_PAGE_H */ |
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h index 8d93f732d72d..10045fd82103 100644 --- a/include/asm-i386/page.h +++ b/include/asm-i386/page.h | |||
@@ -104,20 +104,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
104 | */ | 104 | */ |
105 | extern unsigned int __VMALLOC_RESERVE; | 105 | extern unsigned int __VMALLOC_RESERVE; |
106 | 106 | ||
107 | /* Pure 2^n version of get_order */ | ||
108 | static __inline__ int get_order(unsigned long size) | ||
109 | { | ||
110 | int order; | ||
111 | |||
112 | size = (size-1) >> (PAGE_SHIFT-1); | ||
113 | order = -1; | ||
114 | do { | ||
115 | size >>= 1; | ||
116 | order++; | ||
117 | } while (size); | ||
118 | return order; | ||
119 | } | ||
120 | |||
121 | extern int sysctl_legacy_va_layout; | 107 | extern int sysctl_legacy_va_layout; |
122 | 108 | ||
123 | extern int page_is_ram(unsigned long pagenr); | 109 | extern int page_is_ram(unsigned long pagenr); |
@@ -156,4 +142,6 @@ extern int page_is_ram(unsigned long pagenr); | |||
156 | 142 | ||
157 | #endif /* __KERNEL__ */ | 143 | #endif /* __KERNEL__ */ |
158 | 144 | ||
145 | #include <asm-generic/page.h> | ||
146 | |||
159 | #endif /* _I386_PAGE_H */ | 147 | #endif /* _I386_PAGE_H */ |
diff --git a/include/asm-m32r/page.h b/include/asm-m32r/page.h index 1c6abb9f3f1f..4ab578876361 100644 --- a/include/asm-m32r/page.h +++ b/include/asm-m32r/page.h | |||
@@ -61,25 +61,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
61 | 61 | ||
62 | /* This handles the memory map.. */ | 62 | /* This handles the memory map.. */ |
63 | 63 | ||
64 | #ifndef __ASSEMBLY__ | ||
65 | |||
66 | /* Pure 2^n version of get_order */ | ||
67 | static __inline__ int get_order(unsigned long size) | ||
68 | { | ||
69 | int order; | ||
70 | |||
71 | size = (size - 1) >> (PAGE_SHIFT - 1); | ||
72 | order = -1; | ||
73 | do { | ||
74 | size >>= 1; | ||
75 | order++; | ||
76 | } while (size); | ||
77 | |||
78 | return order; | ||
79 | } | ||
80 | |||
81 | #endif /* __ASSEMBLY__ */ | ||
82 | |||
83 | #define __MEMORY_START CONFIG_MEMORY_START | 64 | #define __MEMORY_START CONFIG_MEMORY_START |
84 | #define __MEMORY_SIZE CONFIG_MEMORY_SIZE | 65 | #define __MEMORY_SIZE CONFIG_MEMORY_SIZE |
85 | 66 | ||
@@ -111,5 +92,7 @@ static __inline__ int get_order(unsigned long size) | |||
111 | 92 | ||
112 | #endif /* __KERNEL__ */ | 93 | #endif /* __KERNEL__ */ |
113 | 94 | ||
95 | #include <asm-generic/page.h> | ||
96 | |||
114 | #endif /* _ASM_M32R_PAGE_H */ | 97 | #endif /* _ASM_M32R_PAGE_H */ |
115 | 98 | ||
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h index 206313e2a817..f206dfbc1d48 100644 --- a/include/asm-m68k/page.h +++ b/include/asm-m68k/page.h | |||
@@ -107,20 +107,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
107 | /* to align the pointer to the (next) page boundary */ | 107 | /* to align the pointer to the (next) page boundary */ |
108 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) | 108 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) |
109 | 109 | ||
110 | /* Pure 2^n version of get_order */ | ||
111 | static inline int get_order(unsigned long size) | ||
112 | { | ||
113 | int order; | ||
114 | |||
115 | size = (size-1) >> (PAGE_SHIFT-1); | ||
116 | order = -1; | ||
117 | do { | ||
118 | size >>= 1; | ||
119 | order++; | ||
120 | } while (size); | ||
121 | return order; | ||
122 | } | ||
123 | |||
124 | #endif /* !__ASSEMBLY__ */ | 110 | #endif /* !__ASSEMBLY__ */ |
125 | 111 | ||
126 | #include <asm/page_offset.h> | 112 | #include <asm/page_offset.h> |
@@ -192,4 +178,6 @@ static inline void *__va(unsigned long x) | |||
192 | 178 | ||
193 | #endif /* __KERNEL__ */ | 179 | #endif /* __KERNEL__ */ |
194 | 180 | ||
181 | #include <asm-generic/page.h> | ||
182 | |||
195 | #endif /* _M68K_PAGE_H */ | 183 | #endif /* _M68K_PAGE_H */ |
diff --git a/include/asm-m68knommu/page.h b/include/asm-m68knommu/page.h index ff6a9265ed1c..942dfbead27f 100644 --- a/include/asm-m68knommu/page.h +++ b/include/asm-m68knommu/page.h | |||
@@ -48,20 +48,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
48 | /* to align the pointer to the (next) page boundary */ | 48 | /* to align the pointer to the (next) page boundary */ |
49 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) | 49 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) |
50 | 50 | ||
51 | /* Pure 2^n version of get_order */ | ||
52 | extern __inline__ int get_order(unsigned long size) | ||
53 | { | ||
54 | int order; | ||
55 | |||
56 | size = (size-1) >> (PAGE_SHIFT-1); | ||
57 | order = -1; | ||
58 | do { | ||
59 | size >>= 1; | ||
60 | order++; | ||
61 | } while (size); | ||
62 | return order; | ||
63 | } | ||
64 | |||
65 | extern unsigned long memory_start; | 51 | extern unsigned long memory_start; |
66 | extern unsigned long memory_end; | 52 | extern unsigned long memory_end; |
67 | 53 | ||
@@ -93,4 +79,6 @@ extern unsigned long memory_end; | |||
93 | 79 | ||
94 | #endif /* __KERNEL__ */ | 80 | #endif /* __KERNEL__ */ |
95 | 81 | ||
82 | #include <asm-generic/page.h> | ||
83 | |||
96 | #endif /* _M68KNOMMU_PAGE_H */ | 84 | #endif /* _M68KNOMMU_PAGE_H */ |
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h index 5cae35cd9ba9..652b6d67a571 100644 --- a/include/asm-mips/page.h +++ b/include/asm-mips/page.h | |||
@@ -103,20 +103,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
103 | #define __pgd(x) ((pgd_t) { (x) } ) | 103 | #define __pgd(x) ((pgd_t) { (x) } ) |
104 | #define __pgprot(x) ((pgprot_t) { (x) } ) | 104 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
105 | 105 | ||
106 | /* Pure 2^n version of get_order */ | ||
107 | static __inline__ int get_order(unsigned long size) | ||
108 | { | ||
109 | int order; | ||
110 | |||
111 | size = (size-1) >> (PAGE_SHIFT-1); | ||
112 | order = -1; | ||
113 | do { | ||
114 | size >>= 1; | ||
115 | order++; | ||
116 | } while (size); | ||
117 | return order; | ||
118 | } | ||
119 | |||
120 | #endif /* !__ASSEMBLY__ */ | 106 | #endif /* !__ASSEMBLY__ */ |
121 | 107 | ||
122 | /* to align the pointer to the (next) page boundary */ | 108 | /* to align the pointer to the (next) page boundary */ |
@@ -148,4 +134,6 @@ static __inline__ int get_order(unsigned long size) | |||
148 | #define WANT_PAGE_VIRTUAL | 134 | #define WANT_PAGE_VIRTUAL |
149 | #endif | 135 | #endif |
150 | 136 | ||
137 | #include <asm-generic/page.h> | ||
138 | |||
151 | #endif /* _ASM_PAGE_H */ | 139 | #endif /* _ASM_PAGE_H */ |
diff --git a/include/asm-parisc/page.h b/include/asm-parisc/page.h index 4a12692f94b4..44eae9f8274d 100644 --- a/include/asm-parisc/page.h +++ b/include/asm-parisc/page.h | |||
@@ -74,20 +74,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
74 | #define __pgd(x) ((pgd_t) { (x) } ) | 74 | #define __pgd(x) ((pgd_t) { (x) } ) |
75 | #define __pgprot(x) ((pgprot_t) { (x) } ) | 75 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
76 | 76 | ||
77 | /* Pure 2^n version of get_order */ | ||
78 | extern __inline__ int get_order(unsigned long size) | ||
79 | { | ||
80 | int order; | ||
81 | |||
82 | size = (size-1) >> (PAGE_SHIFT-1); | ||
83 | order = -1; | ||
84 | do { | ||
85 | size >>= 1; | ||
86 | order++; | ||
87 | } while (size); | ||
88 | return order; | ||
89 | } | ||
90 | |||
91 | typedef struct __physmem_range { | 77 | typedef struct __physmem_range { |
92 | unsigned long start_pfn; | 78 | unsigned long start_pfn; |
93 | unsigned long pages; /* PAGE_SIZE pages */ | 79 | unsigned long pages; /* PAGE_SIZE pages */ |
@@ -159,4 +145,6 @@ extern int npmem_ranges; | |||
159 | 145 | ||
160 | #endif /* __KERNEL__ */ | 146 | #endif /* __KERNEL__ */ |
161 | 147 | ||
148 | #include <asm-generic/page.h> | ||
149 | |||
162 | #endif /* _PARISC_PAGE_H */ | 150 | #endif /* _PARISC_PAGE_H */ |
diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h index a79a08df62bd..a15422bcf30d 100644 --- a/include/asm-ppc64/page.h +++ b/include/asm-ppc64/page.h | |||
@@ -172,20 +172,6 @@ typedef unsigned long pgprot_t; | |||
172 | 172 | ||
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | /* Pure 2^n version of get_order */ | ||
176 | static inline int get_order(unsigned long size) | ||
177 | { | ||
178 | int order; | ||
179 | |||
180 | size = (size-1) >> (PAGE_SHIFT-1); | ||
181 | order = -1; | ||
182 | do { | ||
183 | size >>= 1; | ||
184 | order++; | ||
185 | } while (size); | ||
186 | return order; | ||
187 | } | ||
188 | |||
189 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) | 175 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) |
190 | 176 | ||
191 | extern int page_is_ram(unsigned long pfn); | 177 | extern int page_is_ram(unsigned long pfn); |
@@ -270,4 +256,7 @@ extern u64 ppc64_pft_size; /* Log 2 of page table size */ | |||
270 | VM_STACK_DEFAULT_FLAGS32 : VM_STACK_DEFAULT_FLAGS64) | 256 | VM_STACK_DEFAULT_FLAGS32 : VM_STACK_DEFAULT_FLAGS64) |
271 | 257 | ||
272 | #endif /* __KERNEL__ */ | 258 | #endif /* __KERNEL__ */ |
259 | |||
260 | #include <asm-generic/page.h> | ||
261 | |||
273 | #endif /* _PPC64_PAGE_H */ | 262 | #endif /* _PPC64_PAGE_H */ |
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h index 2be287b9df88..2430c561e021 100644 --- a/include/asm-s390/page.h +++ b/include/asm-s390/page.h | |||
@@ -111,20 +111,6 @@ static inline void copy_page(void *to, void *from) | |||
111 | #define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr) | 111 | #define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr) |
112 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE | 112 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE |
113 | 113 | ||
114 | /* Pure 2^n version of get_order */ | ||
115 | extern __inline__ int get_order(unsigned long size) | ||
116 | { | ||
117 | int order; | ||
118 | |||
119 | size = (size-1) >> (PAGE_SHIFT-1); | ||
120 | order = -1; | ||
121 | do { | ||
122 | size >>= 1; | ||
123 | order++; | ||
124 | } while (size); | ||
125 | return order; | ||
126 | } | ||
127 | |||
128 | /* | 114 | /* |
129 | * These are used to make use of C type-checking.. | 115 | * These are used to make use of C type-checking.. |
130 | */ | 116 | */ |
@@ -207,4 +193,6 @@ page_get_storage_key(unsigned long addr) | |||
207 | 193 | ||
208 | #endif /* __KERNEL__ */ | 194 | #endif /* __KERNEL__ */ |
209 | 195 | ||
196 | #include <asm-generic/page.h> | ||
197 | |||
210 | #endif /* _S390_PAGE_H */ | 198 | #endif /* _S390_PAGE_H */ |
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h index 180467be8e7b..324e6cc5ecf7 100644 --- a/include/asm-sh/page.h +++ b/include/asm-sh/page.h | |||
@@ -122,24 +122,8 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
122 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | 122 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ |
123 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | 123 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
124 | 124 | ||
125 | #ifndef __ASSEMBLY__ | ||
126 | |||
127 | /* Pure 2^n version of get_order */ | ||
128 | static __inline__ int get_order(unsigned long size) | ||
129 | { | ||
130 | int order; | ||
131 | |||
132 | size = (size-1) >> (PAGE_SHIFT-1); | ||
133 | order = -1; | ||
134 | do { | ||
135 | size >>= 1; | ||
136 | order++; | ||
137 | } while (size); | ||
138 | return order; | ||
139 | } | ||
140 | |||
141 | #endif | ||
142 | |||
143 | #endif /* __KERNEL__ */ | 125 | #endif /* __KERNEL__ */ |
144 | 126 | ||
127 | #include <asm-generic/page.h> | ||
128 | |||
145 | #endif /* __ASM_SH_PAGE_H */ | 129 | #endif /* __ASM_SH_PAGE_H */ |
diff --git a/include/asm-sh64/page.h b/include/asm-sh64/page.h index d6167f1c0e99..c86df90f7cbd 100644 --- a/include/asm-sh64/page.h +++ b/include/asm-sh64/page.h | |||
@@ -115,24 +115,8 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
115 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | 115 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ |
116 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | 116 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
117 | 117 | ||
118 | #ifndef __ASSEMBLY__ | ||
119 | |||
120 | /* Pure 2^n version of get_order */ | ||
121 | extern __inline__ int get_order(unsigned long size) | ||
122 | { | ||
123 | int order; | ||
124 | |||
125 | size = (size-1) >> (PAGE_SHIFT-1); | ||
126 | order = -1; | ||
127 | do { | ||
128 | size >>= 1; | ||
129 | order++; | ||
130 | } while (size); | ||
131 | return order; | ||
132 | } | ||
133 | |||
134 | #endif | ||
135 | |||
136 | #endif /* __KERNEL__ */ | 118 | #endif /* __KERNEL__ */ |
137 | 119 | ||
120 | #include <asm-generic/page.h> | ||
121 | |||
138 | #endif /* __ASM_SH64_PAGE_H */ | 122 | #endif /* __ASM_SH64_PAGE_H */ |
diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h index 383060e90d94..9122684f6c1e 100644 --- a/include/asm-sparc/page.h +++ b/include/asm-sparc/page.h | |||
@@ -132,20 +132,6 @@ BTFIXUPDEF_SETHI(sparc_unmapped_base) | |||
132 | 132 | ||
133 | #define TASK_UNMAPPED_BASE BTFIXUP_SETHI(sparc_unmapped_base) | 133 | #define TASK_UNMAPPED_BASE BTFIXUP_SETHI(sparc_unmapped_base) |
134 | 134 | ||
135 | /* Pure 2^n version of get_order */ | ||
136 | extern __inline__ int get_order(unsigned long size) | ||
137 | { | ||
138 | int order; | ||
139 | |||
140 | size = (size-1) >> (PAGE_SHIFT-1); | ||
141 | order = -1; | ||
142 | do { | ||
143 | size >>= 1; | ||
144 | order++; | ||
145 | } while (size); | ||
146 | return order; | ||
147 | } | ||
148 | |||
149 | #else /* !(__ASSEMBLY__) */ | 135 | #else /* !(__ASSEMBLY__) */ |
150 | 136 | ||
151 | #define __pgprot(x) (x) | 137 | #define __pgprot(x) (x) |
@@ -178,4 +164,6 @@ extern unsigned long pfn_base; | |||
178 | 164 | ||
179 | #endif /* __KERNEL__ */ | 165 | #endif /* __KERNEL__ */ |
180 | 166 | ||
167 | #include <asm-generic/page.h> | ||
168 | |||
181 | #endif /* _SPARC_PAGE_H */ | 169 | #endif /* _SPARC_PAGE_H */ |
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h index b87dbbd64bc9..c9f8ef208ea5 100644 --- a/include/asm-sparc64/page.h +++ b/include/asm-sparc64/page.h | |||
@@ -150,20 +150,6 @@ struct sparc_phys_banks { | |||
150 | 150 | ||
151 | extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS]; | 151 | extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS]; |
152 | 152 | ||
153 | /* Pure 2^n version of get_order */ | ||
154 | static __inline__ int get_order(unsigned long size) | ||
155 | { | ||
156 | int order; | ||
157 | |||
158 | size = (size-1) >> (PAGE_SHIFT-1); | ||
159 | order = -1; | ||
160 | do { | ||
161 | size >>= 1; | ||
162 | order++; | ||
163 | } while (size); | ||
164 | return order; | ||
165 | } | ||
166 | |||
167 | #endif /* !(__ASSEMBLY__) */ | 153 | #endif /* !(__ASSEMBLY__) */ |
168 | 154 | ||
169 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | 155 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ |
@@ -171,4 +157,6 @@ static __inline__ int get_order(unsigned long size) | |||
171 | 157 | ||
172 | #endif /* !(__KERNEL__) */ | 158 | #endif /* !(__KERNEL__) */ |
173 | 159 | ||
160 | #include <asm-generic/page.h> | ||
161 | |||
174 | #endif /* !(_SPARC64_PAGE_H) */ | 162 | #endif /* !(_SPARC64_PAGE_H) */ |
diff --git a/include/asm-um/page.h b/include/asm-um/page.h index f58aedadeb4e..bd850a249183 100644 --- a/include/asm-um/page.h +++ b/include/asm-um/page.h | |||
@@ -116,24 +116,12 @@ extern void *to_virt(unsigned long phys); | |||
116 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 116 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
117 | #define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v))) | 117 | #define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v))) |
118 | 118 | ||
119 | /* Pure 2^n version of get_order */ | ||
120 | static __inline__ int get_order(unsigned long size) | ||
121 | { | ||
122 | int order; | ||
123 | |||
124 | size = (size-1) >> (PAGE_SHIFT-1); | ||
125 | order = -1; | ||
126 | do { | ||
127 | size >>= 1; | ||
128 | order++; | ||
129 | } while (size); | ||
130 | return order; | ||
131 | } | ||
132 | |||
133 | extern struct page *arch_validate(struct page *page, int mask, int order); | 119 | extern struct page *arch_validate(struct page *page, int mask, int order); |
134 | #define HAVE_ARCH_VALIDATE | 120 | #define HAVE_ARCH_VALIDATE |
135 | 121 | ||
136 | extern void arch_free_page(struct page *page, int order); | 122 | extern void arch_free_page(struct page *page, int order); |
137 | #define HAVE_ARCH_FREE_PAGE | 123 | #define HAVE_ARCH_FREE_PAGE |
138 | 124 | ||
125 | #include <asm-generic/page.h> | ||
126 | |||
139 | #endif | 127 | #endif |
diff --git a/include/asm-v850/page.h b/include/asm-v850/page.h index d6091622935d..b4bc85e7b91a 100644 --- a/include/asm-v850/page.h +++ b/include/asm-v850/page.h | |||
@@ -98,25 +98,6 @@ typedef unsigned long pgprot_t; | |||
98 | #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) | 98 | #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) |
99 | 99 | ||
100 | 100 | ||
101 | #ifndef __ASSEMBLY__ | ||
102 | |||
103 | /* Pure 2^n version of get_order */ | ||
104 | extern __inline__ int get_order (unsigned long size) | ||
105 | { | ||
106 | int order; | ||
107 | |||
108 | size = (size-1) >> (PAGE_SHIFT-1); | ||
109 | order = -1; | ||
110 | do { | ||
111 | size >>= 1; | ||
112 | order++; | ||
113 | } while (size); | ||
114 | return order; | ||
115 | } | ||
116 | |||
117 | #endif /* !__ASSEMBLY__ */ | ||
118 | |||
119 | |||
120 | /* No current v850 processor has virtual memory. */ | 101 | /* No current v850 processor has virtual memory. */ |
121 | #define __virt_to_phys(addr) (addr) | 102 | #define __virt_to_phys(addr) (addr) |
122 | #define __phys_to_virt(addr) (addr) | 103 | #define __phys_to_virt(addr) (addr) |
@@ -144,4 +125,6 @@ extern __inline__ int get_order (unsigned long size) | |||
144 | 125 | ||
145 | #endif /* KERNEL */ | 126 | #endif /* KERNEL */ |
146 | 127 | ||
128 | #include <asm-generic/page.h> | ||
129 | |||
147 | #endif /* __V850_PAGE_H__ */ | 130 | #endif /* __V850_PAGE_H__ */ |
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h index 431318764af6..fcf890aa8c81 100644 --- a/include/asm-x86_64/page.h +++ b/include/asm-x86_64/page.h | |||
@@ -92,20 +92,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
92 | 92 | ||
93 | #include <asm/bug.h> | 93 | #include <asm/bug.h> |
94 | 94 | ||
95 | /* Pure 2^n version of get_order */ | ||
96 | extern __inline__ int get_order(unsigned long size) | ||
97 | { | ||
98 | int order; | ||
99 | |||
100 | size = (size-1) >> (PAGE_SHIFT-1); | ||
101 | order = -1; | ||
102 | do { | ||
103 | size >>= 1; | ||
104 | order++; | ||
105 | } while (size); | ||
106 | return order; | ||
107 | } | ||
108 | |||
109 | #endif /* __ASSEMBLY__ */ | 95 | #endif /* __ASSEMBLY__ */ |
110 | 96 | ||
111 | #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) | 97 | #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) |
@@ -141,4 +127,6 @@ extern __inline__ int get_order(unsigned long size) | |||
141 | 127 | ||
142 | #endif /* __KERNEL__ */ | 128 | #endif /* __KERNEL__ */ |
143 | 129 | ||
130 | #include <asm-generic/page.h> | ||
131 | |||
144 | #endif /* _X86_64_PAGE_H */ | 132 | #endif /* _X86_64_PAGE_H */ |