aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2007-12-13 16:15:35 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2008-02-01 14:34:56 -0800
commit041509db390cf97b09df0f51024f5d40407938db (patch)
treed4b0c303acc9fb2bb2c38c6a4ccc820a3e690e4e /drivers
parentd0fab0ddf3fca22f73b95d2e15b598fa17876c69 (diff)
USB: mon nopage
Convert USB mon driver from nopage to fault. Signed-off-by: Nick Piggin <npiggin@suse.de> Acked-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/mon/mon_bin.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
index 81aab527024..d70666f1a90 100644
--- a/drivers/usb/mon/mon_bin.c
+++ b/drivers/usb/mon/mon_bin.c
@@ -1047,33 +1047,31 @@ static void mon_bin_vma_close(struct vm_area_struct *vma)
/*
* Map ring pages to user space.
*/
-struct page *mon_bin_vma_nopage(struct vm_area_struct *vma,
- unsigned long address, int *type)
+static int mon_bin_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
{
struct mon_reader_bin *rp = vma->vm_private_data;
unsigned long offset, chunk_idx;
struct page *pageptr;
- offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT);
+ offset = vmf->pgoff << PAGE_SHIFT;
if (offset >= rp->b_size)
- return NOPAGE_SIGBUS;
+ return VM_FAULT_SIGBUS;
chunk_idx = offset / CHUNK_SIZE;
pageptr = rp->b_vec[chunk_idx].pg;
get_page(pageptr);
- if (type)
- *type = VM_FAULT_MINOR;
- return pageptr;
+ vmf->page = pageptr;
+ return 0;
}
struct vm_operations_struct mon_bin_vm_ops = {
.open = mon_bin_vma_open,
.close = mon_bin_vma_close,
- .nopage = mon_bin_vma_nopage,
+ .fault = mon_bin_vma_fault,
};
int mon_bin_mmap(struct file *filp, struct vm_area_struct *vma)
{
- /* don't do anything here: "nopage" will set up page table entries */
+ /* don't do anything here: "fault" will set up page table entries */
vma->vm_ops = &mon_bin_vm_ops;
vma->vm_flags |= VM_RESERVED;
vma->vm_private_data = filp->private_data;