aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyril Chemparathy <cyril@ti.com>2012-09-12 14:05:58 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-24 18:32:50 -0400
commit7e6735c3578e76c270a2797225a4214176ba13ef (patch)
treebc196f86d8699cd1eba80e8a3ebc1ba38e8a2bba
parent6f0c0580b70c89094b3422ba81118c7b959c7556 (diff)
/dev/mem: use phys_addr_t for physical addresses
This patch fixes the /dev/mem driver to use phys_addr_t for physical addresses. This is required on PAE systems, especially those that run entirely out of >4G physical memory space. Signed-off-by: Cyril Chemparathy <cyril@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/arm/include/asm/io.h2
-rw-r--r--arch/arm/mm/mmap.c2
-rw-r--r--arch/ia64/include/asm/io.h2
-rw-r--r--arch/ia64/kernel/efi.c2
-rw-r--r--arch/sh/include/asm/io.h2
-rw-r--r--arch/sh/mm/mmap.c2
-rw-r--r--drivers/char/mem.c10
7 files changed, 11 insertions, 11 deletions
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 35c1ed89b936..f52a93d98667 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -374,7 +374,7 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
374 374
375#ifdef CONFIG_MMU 375#ifdef CONFIG_MMU
376#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 376#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
377extern int valid_phys_addr_range(unsigned long addr, size_t size); 377extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
378extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); 378extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
379extern int devmem_is_allowed(unsigned long pfn); 379extern int devmem_is_allowed(unsigned long pfn);
380#endif 380#endif
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index ce8cb1970d7a..89f2b7f7b042 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -279,7 +279,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
279 * You really shouldn't be using read() or write() on /dev/mem. This 279 * You really shouldn't be using read() or write() on /dev/mem. This
280 * might go away in the future. 280 * might go away in the future.
281 */ 281 */
282int valid_phys_addr_range(unsigned long addr, size_t size) 282int valid_phys_addr_range(phys_addr_t addr, size_t size)
283{ 283{
284 if (addr < PHYS_OFFSET) 284 if (addr < PHYS_OFFSET)
285 return 0; 285 return 0;
diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
index 2c26321c28c3..74a7cc3293bc 100644
--- a/arch/ia64/include/asm/io.h
+++ b/arch/ia64/include/asm/io.h
@@ -90,7 +90,7 @@ phys_to_virt (unsigned long address)
90 90
91#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 91#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
92extern u64 kern_mem_attribute (unsigned long phys_addr, unsigned long size); 92extern u64 kern_mem_attribute (unsigned long phys_addr, unsigned long size);
93extern int valid_phys_addr_range (unsigned long addr, size_t count); /* efi.c */ 93extern int valid_phys_addr_range (phys_addr_t addr, size_t count); /* efi.c */
94extern int valid_mmap_phys_addr_range (unsigned long pfn, size_t count); 94extern int valid_mmap_phys_addr_range (unsigned long pfn, size_t count);
95 95
96/* 96/*
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index d37bbd48637f..f034563aeae5 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -870,7 +870,7 @@ kern_mem_attribute (unsigned long phys_addr, unsigned long size)
870EXPORT_SYMBOL(kern_mem_attribute); 870EXPORT_SYMBOL(kern_mem_attribute);
871 871
872int 872int
873valid_phys_addr_range (unsigned long phys_addr, unsigned long size) 873valid_phys_addr_range (phys_addr_t phys_addr, unsigned long size)
874{ 874{
875 u64 attr; 875 u64 attr;
876 876
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 73a23f4617a3..629db2ad7916 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -382,7 +382,7 @@ static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }
382#define xlate_dev_kmem_ptr(p) p 382#define xlate_dev_kmem_ptr(p) p
383 383
384#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 384#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
385int valid_phys_addr_range(unsigned long addr, size_t size); 385int valid_phys_addr_range(phys_addr_t addr, size_t size);
386int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); 386int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
387 387
388#endif /* __KERNEL__ */ 388#endif /* __KERNEL__ */
diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c
index afeb710ec5c3..80bf494ddbcb 100644
--- a/arch/sh/mm/mmap.c
+++ b/arch/sh/mm/mmap.c
@@ -238,7 +238,7 @@ bottomup:
238 * You really shouldn't be using read() or write() on /dev/mem. This 238 * You really shouldn't be using read() or write() on /dev/mem. This
239 * might go away in the future. 239 * might go away in the future.
240 */ 240 */
241int valid_phys_addr_range(unsigned long addr, size_t count) 241int valid_phys_addr_range(phys_addr_t addr, size_t count)
242{ 242{
243 if (addr < __MEMORY_START) 243 if (addr < __MEMORY_START)
244 return 0; 244 return 0;
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 0537903c985b..c6fa3bc2baa8 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -48,7 +48,7 @@ static inline unsigned long size_inside_page(unsigned long start,
48} 48}
49 49
50#ifndef ARCH_HAS_VALID_PHYS_ADDR_RANGE 50#ifndef ARCH_HAS_VALID_PHYS_ADDR_RANGE
51static inline int valid_phys_addr_range(unsigned long addr, size_t count) 51static inline int valid_phys_addr_range(phys_addr_t addr, size_t count)
52{ 52{
53 return addr + count <= __pa(high_memory); 53 return addr + count <= __pa(high_memory);
54} 54}
@@ -96,7 +96,7 @@ void __weak unxlate_dev_mem_ptr(unsigned long phys, void *addr)
96static ssize_t read_mem(struct file *file, char __user *buf, 96static ssize_t read_mem(struct file *file, char __user *buf,
97 size_t count, loff_t *ppos) 97 size_t count, loff_t *ppos)
98{ 98{
99 unsigned long p = *ppos; 99 phys_addr_t p = *ppos;
100 ssize_t read, sz; 100 ssize_t read, sz;
101 char *ptr; 101 char *ptr;
102 102
@@ -153,7 +153,7 @@ static ssize_t read_mem(struct file *file, char __user *buf,
153static ssize_t write_mem(struct file *file, const char __user *buf, 153static ssize_t write_mem(struct file *file, const char __user *buf,
154 size_t count, loff_t *ppos) 154 size_t count, loff_t *ppos)
155{ 155{
156 unsigned long p = *ppos; 156 phys_addr_t p = *ppos;
157 ssize_t written, sz; 157 ssize_t written, sz;
158 unsigned long copied; 158 unsigned long copied;
159 void *ptr; 159 void *ptr;
@@ -226,7 +226,7 @@ int __weak phys_mem_access_prot_allowed(struct file *file,
226 * 226 *
227 */ 227 */
228#ifdef pgprot_noncached 228#ifdef pgprot_noncached
229static int uncached_access(struct file *file, unsigned long addr) 229static int uncached_access(struct file *file, phys_addr_t addr)
230{ 230{
231#if defined(CONFIG_IA64) 231#if defined(CONFIG_IA64)
232 /* 232 /*
@@ -258,7 +258,7 @@ static pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
258 unsigned long size, pgprot_t vma_prot) 258 unsigned long size, pgprot_t vma_prot)
259{ 259{
260#ifdef pgprot_noncached 260#ifdef pgprot_noncached
261 unsigned long offset = pfn << PAGE_SHIFT; 261 phys_addr_t offset = pfn << PAGE_SHIFT;
262 262
263 if (uncached_access(file, offset)) 263 if (uncached_access(file, offset))
264 return pgprot_noncached(vma_prot); 264 return pgprot_noncached(vma_prot);