diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-08-18 22:14:39 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-08-18 22:14:39 -0400 |
commit | a3bc068022b968a3042b48eb9a8e8b0418fb9cdd (patch) | |
tree | 6bbc2806756924105802f4584157396fb98d282c /drivers/char/mem.c | |
parent | 54cfb5aa0f4859bd38706eabe0118175780a542f (diff) | |
parent | 91aa9fb573fcc50bc74d5ee64c7e9b36131f1804 (diff) |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'drivers/char/mem.c')
-rw-r--r-- | drivers/char/mem.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 42187381506b..850a78c9c4bc 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -261,7 +261,11 @@ static int mmap_mem(struct file * file, struct vm_area_struct * vma) | |||
261 | 261 | ||
262 | static int mmap_kmem(struct file * file, struct vm_area_struct * vma) | 262 | static int mmap_kmem(struct file * file, struct vm_area_struct * vma) |
263 | { | 263 | { |
264 | unsigned long long val; | 264 | unsigned long pfn; |
265 | |||
266 | /* Turn a kernel-virtual address into a physical page frame */ | ||
267 | pfn = __pa((u64)vma->vm_pgoff << PAGE_SHIFT) >> PAGE_SHIFT; | ||
268 | |||
265 | /* | 269 | /* |
266 | * RED-PEN: on some architectures there is more mapped memory | 270 | * RED-PEN: on some architectures there is more mapped memory |
267 | * than available in mem_map which pfn_valid checks | 271 | * than available in mem_map which pfn_valid checks |
@@ -269,10 +273,10 @@ static int mmap_kmem(struct file * file, struct vm_area_struct * vma) | |||
269 | * | 273 | * |
270 | * RED-PEN: vmalloc is not supported right now. | 274 | * RED-PEN: vmalloc is not supported right now. |
271 | */ | 275 | */ |
272 | if (!pfn_valid(vma->vm_pgoff)) | 276 | if (!pfn_valid(pfn)) |
273 | return -EIO; | 277 | return -EIO; |
274 | val = (u64)vma->vm_pgoff << PAGE_SHIFT; | 278 | |
275 | vma->vm_pgoff = __pa(val) >> PAGE_SHIFT; | 279 | vma->vm_pgoff = pfn; |
276 | return mmap_mem(file, vma); | 280 | return mmap_mem(file, vma); |
277 | } | 281 | } |
278 | 282 | ||