diff options
author | Nick Piggin <npiggin@suse.de> | 2008-02-06 04:37:35 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-06 13:41:07 -0500 |
commit | a18b630d1becdf1a087de644fea080c1977bcf10 (patch) | |
tree | 1972b084c14bfe46eeba0c05270aa45b3225619c | |
parent | a1e096129bff79ae551592539bef19bfb5c9efa1 (diff) |
uio: nopage
Convert uio from nopage to fault.
Signed-off-by: Nick Piggin <npiggin@suse.de>
Acked-by: Hans J Koch <hjk@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/uio/uio.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index cc246faa3590..2a77e9d42c68 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -417,30 +417,28 @@ static void uio_vma_close(struct vm_area_struct *vma) | |||
417 | idev->vma_count--; | 417 | idev->vma_count--; |
418 | } | 418 | } |
419 | 419 | ||
420 | static struct page *uio_vma_nopage(struct vm_area_struct *vma, | 420 | static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
421 | unsigned long address, int *type) | ||
422 | { | 421 | { |
423 | struct uio_device *idev = vma->vm_private_data; | 422 | struct uio_device *idev = vma->vm_private_data; |
424 | struct page* page = NOPAGE_SIGBUS; | 423 | struct page *page; |
425 | 424 | ||
426 | int mi = uio_find_mem_index(vma); | 425 | int mi = uio_find_mem_index(vma); |
427 | if (mi < 0) | 426 | if (mi < 0) |
428 | return page; | 427 | return VM_FAULT_SIGBUS; |
429 | 428 | ||
430 | if (idev->info->mem[mi].memtype == UIO_MEM_LOGICAL) | 429 | if (idev->info->mem[mi].memtype == UIO_MEM_LOGICAL) |
431 | page = virt_to_page(idev->info->mem[mi].addr); | 430 | page = virt_to_page(idev->info->mem[mi].addr); |
432 | else | 431 | else |
433 | page = vmalloc_to_page((void*)idev->info->mem[mi].addr); | 432 | page = vmalloc_to_page((void*)idev->info->mem[mi].addr); |
434 | get_page(page); | 433 | get_page(page); |
435 | if (type) | 434 | vmf->page = page; |
436 | *type = VM_FAULT_MINOR; | 435 | return 0; |
437 | return page; | ||
438 | } | 436 | } |
439 | 437 | ||
440 | static struct vm_operations_struct uio_vm_ops = { | 438 | static struct vm_operations_struct uio_vm_ops = { |
441 | .open = uio_vma_open, | 439 | .open = uio_vma_open, |
442 | .close = uio_vma_close, | 440 | .close = uio_vma_close, |
443 | .nopage = uio_vma_nopage, | 441 | .fault = uio_vma_fault, |
444 | }; | 442 | }; |
445 | 443 | ||
446 | static int uio_mmap_physical(struct vm_area_struct *vma) | 444 | static int uio_mmap_physical(struct vm_area_struct *vma) |