aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/mon
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2007-12-13 19:15:35 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-02-01 17:34:56 -0500
commit041509db390cf97b09df0f51024f5d40407938db (patch)
treed4b0c303acc9fb2bb2c38c6a4ccc820a3e690e4e /drivers/usb/mon
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/usb/mon')
-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 81aab527024c..d70666f1a90d 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)
1047/* 1047/*
1048 * Map ring pages to user space. 1048 * Map ring pages to user space.
1049 */ 1049 */
1050struct page *mon_bin_vma_nopage(struct vm_area_struct *vma, 1050static int mon_bin_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1051 unsigned long address, int *type)
1052{ 1051{
1053 struct mon_reader_bin *rp = vma->vm_private_data; 1052 struct mon_reader_bin *rp = vma->vm_private_data;
1054 unsigned long offset, chunk_idx; 1053 unsigned long offset, chunk_idx;
1055 struct page *pageptr; 1054 struct page *pageptr;
1056 1055
1057 offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT); 1056 offset = vmf->pgoff << PAGE_SHIFT;
1058 if (offset >= rp->b_size) 1057 if (offset >= rp->b_size)
1059 return NOPAGE_SIGBUS; 1058 return VM_FAULT_SIGBUS;
1060 chunk_idx = offset / CHUNK_SIZE; 1059 chunk_idx = offset / CHUNK_SIZE;
1061 pageptr = rp->b_vec[chunk_idx].pg; 1060 pageptr = rp->b_vec[chunk_idx].pg;
1062 get_page(pageptr); 1061 get_page(pageptr);
1063 if (type) 1062 vmf->page = pageptr;
1064 *type = VM_FAULT_MINOR; 1063 return 0;
1065 return pageptr;
1066} 1064}
1067 1065
1068struct vm_operations_struct mon_bin_vm_ops = { 1066struct vm_operations_struct mon_bin_vm_ops = {
1069 .open = mon_bin_vma_open, 1067 .open = mon_bin_vma_open,
1070 .close = mon_bin_vma_close, 1068 .close = mon_bin_vma_close,
1071 .nopage = mon_bin_vma_nopage, 1069 .fault = mon_bin_vma_fault,
1072}; 1070};
1073 1071
1074int mon_bin_mmap(struct file *filp, struct vm_area_struct *vma) 1072int mon_bin_mmap(struct file *filp, struct vm_area_struct *vma)
1075{ 1073{
1076 /* don't do anything here: "nopage" will set up page table entries */ 1074 /* don't do anything here: "fault" will set up page table entries */
1077 vma->vm_ops = &mon_bin_vm_ops; 1075 vma->vm_ops = &mon_bin_vm_ops;
1078 vma->vm_flags |= VM_RESERVED; 1076 vma->vm_flags |= VM_RESERVED;
1079 vma->vm_private_data = filp->private_data; 1077 vma->vm_private_data = filp->private_data;