From 124116bb333774330f75c103b16b419db3a15ea3 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 19 Jun 2003 02:14:04 +0100 Subject: [ARM] Tighten virt_addr_valid(), add comments for __pa and friends. Ensure virt_addr_valid(x) works correctly for pointers. Add comments indicating that drivers should not use virt_to_phys and/or __pa to obtain an address for DMA. --- include/asm-arm/memory.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-arm/memory.h b/include/asm-arm/memory.h index 38682a28d121..1b61a0e02c20 100644 --- a/include/asm-arm/memory.h +++ b/include/asm-arm/memory.h @@ -27,6 +27,9 @@ /* * These are *only* valid on the kernel direct mapped RAM memory. + * Note: Drivers should NOT use these. They are the wrong + * translation for translating DMA addresses. Use the driver + * DMA support - see dma-mapping.h. */ static inline unsigned long virt_to_phys(void *x) { @@ -38,6 +41,9 @@ static inline void *phys_to_virt(unsigned long x) return (void *)(__phys_to_virt((unsigned long)(x))); } +/* + * Drivers should NOT use these either. + */ #define __pa(x) __virt_to_phys((unsigned long)(x)) #define __va(x) ((void *)__phys_to_virt((unsigned long)(x))) @@ -72,7 +78,7 @@ static inline void *phys_to_virt(unsigned long x) #define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr)) #define virt_to_page(kaddr) (pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)) -#define virt_addr_valid(kaddr) ((kaddr) >= PAGE_OFFSET && (kaddr) < (unsigned long)high_memory) +#define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) #define PHYS_TO_NID(addr) (0) -- cgit v1.2.3