aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorSantosh Shilimkar <santosh.shilimkar@ti.com>2013-07-31 12:44:41 -0400
committerSantosh Shilimkar <santosh.shilimkar@ti.com>2013-10-10 20:22:47 -0400
commitca5a45c06cd4764fb8510740f7fc550d9a0208d4 (patch)
tree8d59cda46f47b7d6f97f3acb17f30b137e7914e2 /arch/arm
parent4a10c2ac2f368583138b774ca41fac4207911983 (diff)
ARM: mm: use phys_addr_t appropriately in p2v and v2p conversions
Fix remainder types used when converting back and forth between physical and virtual addresses. Cc: Russell King <linux@arm.linux.org.uk> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/include/asm/memory.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index e750a938fd3c..c133bd915f48 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -185,22 +185,32 @@ extern unsigned long __pv_phys_offset;
185 : "=r" (to) \ 185 : "=r" (to) \
186 : "r" (from), "I" (type)) 186 : "r" (from), "I" (type))
187 187
188static inline unsigned long __virt_to_phys(unsigned long x) 188static inline phys_addr_t __virt_to_phys(unsigned long x)
189{ 189{
190 unsigned long t; 190 unsigned long t;
191 __pv_stub(x, t, "add", __PV_BITS_31_24); 191 __pv_stub(x, t, "add", __PV_BITS_31_24);
192 return t; 192 return t;
193} 193}
194 194
195static inline unsigned long __phys_to_virt(unsigned long x) 195static inline unsigned long __phys_to_virt(phys_addr_t x)
196{ 196{
197 unsigned long t; 197 unsigned long t;
198 __pv_stub(x, t, "sub", __PV_BITS_31_24); 198 __pv_stub(x, t, "sub", __PV_BITS_31_24);
199 return t; 199 return t;
200} 200}
201
201#else 202#else
202#define __virt_to_phys(x) ((x) - PAGE_OFFSET + PHYS_OFFSET) 203
203#define __phys_to_virt(x) ((x) - PHYS_OFFSET + PAGE_OFFSET) 204static inline phys_addr_t __virt_to_phys(unsigned long x)
205{
206 return (phys_addr_t)x - PAGE_OFFSET + PHYS_OFFSET;
207}
208
209static inline unsigned long __phys_to_virt(phys_addr_t x)
210{
211 return x - PHYS_OFFSET + PAGE_OFFSET;
212}
213
204#endif 214#endif
205#endif 215#endif
206#endif /* __ASSEMBLY__ */ 216#endif /* __ASSEMBLY__ */
@@ -238,14 +248,14 @@ static inline phys_addr_t virt_to_phys(const volatile void *x)
238 248
239static inline void *phys_to_virt(phys_addr_t x) 249static inline void *phys_to_virt(phys_addr_t x)
240{ 250{
241 return (void *)(__phys_to_virt((unsigned long)(x))); 251 return (void *)__phys_to_virt(x);
242} 252}
243 253
244/* 254/*
245 * Drivers should NOT use these either. 255 * Drivers should NOT use these either.
246 */ 256 */
247#define __pa(x) __virt_to_phys((unsigned long)(x)) 257#define __pa(x) __virt_to_phys((unsigned long)(x))
248#define __va(x) ((void *)__phys_to_virt((unsigned long)(x))) 258#define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x)))
249#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 259#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
250 260
251/* 261/*