diff options
author | Cyril Chemparathy <cyril@ti.com> | 2012-09-12 14:05:58 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-24 18:32:50 -0400 |
commit | 7e6735c3578e76c270a2797225a4214176ba13ef (patch) | |
tree | bc196f86d8699cd1eba80e8a3ebc1ba38e8a2bba /drivers/char/mem.c | |
parent | 6f0c0580b70c89094b3422ba81118c7b959c7556 (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>
Diffstat (limited to 'drivers/char/mem.c')
-rw-r--r-- | drivers/char/mem.c | 10 |
1 files changed, 5 insertions, 5 deletions
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 |
51 | static inline int valid_phys_addr_range(unsigned long addr, size_t count) | 51 | static 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) | |||
96 | static ssize_t read_mem(struct file *file, char __user *buf, | 96 | static 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, | |||
153 | static ssize_t write_mem(struct file *file, const char __user *buf, | 153 | static 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 |
229 | static int uncached_access(struct file *file, unsigned long addr) | 229 | static 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); |