diff options
Diffstat (limited to 'drivers/usb/mon')
-rw-r--r-- | drivers/usb/mon/mon_bin.c | 16 |
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 | */ |
1050 | struct page *mon_bin_vma_nopage(struct vm_area_struct *vma, | 1050 | static 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 | ||
1068 | struct vm_operations_struct mon_bin_vm_ops = { | 1066 | struct 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 | ||
1074 | int mon_bin_mmap(struct file *filp, struct vm_area_struct *vma) | 1072 | int 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; |